1 /**
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19 package org.apache.hadoop.hbase.client.security;
20
21 import org.apache.hadoop.hbase.classification.InterfaceAudience;
22 import org.apache.hadoop.hbase.classification.InterfaceStability;
23
24 /**
25 * Available security capabilities
26 */
27 @InterfaceAudience.Public
28 @InterfaceStability.Evolving
29 public enum SecurityCapability {
30 // Note to implementors: These must match the numbering of Capability values in MasterProtos
31 SIMPLE_AUTHENTICATION(0),
32 SECURE_AUTHENTICATION(1),
33 AUTHORIZATION(2),
34 CELL_AUTHORIZATION(3),
35 CELL_VISIBILITY(4);
36
37 private int value;
38
39 public int getValue() {
40 return value;
41 }
42
43 public String getName() {
44 return toString();
45 }
46
47 private SecurityCapability(int value) {
48 this.value = value;
49 }
50
51 public static SecurityCapability valueOf(int value) {
52 switch (value) {
53 case 0: return SIMPLE_AUTHENTICATION;
54 case 1: return SECURE_AUTHENTICATION;
55 case 2: return AUTHORIZATION;
56 case 3: return CELL_AUTHORIZATION;
57 case 4: return CELL_VISIBILITY;
58 default:
59 throw new IllegalArgumentException("Unknown SecurityCapability value " + value);
60 }
61 }
62 };
63