1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.security.token;
20
21 import java.util.Collection;
22
23 import org.apache.hadoop.io.Text;
24 import org.apache.hadoop.security.token.Token;
25 import org.apache.hadoop.security.token.TokenIdentifier;
26 import org.apache.hadoop.security.token.TokenSelector;
27
28 public class AuthenticationTokenSelector
29 implements TokenSelector<AuthenticationTokenIdentifier> {
30
31 public AuthenticationTokenSelector() {
32 }
33
34 @Override
35 public Token<AuthenticationTokenIdentifier> selectToken(Text serviceName,
36 Collection<Token<? extends TokenIdentifier>> tokens) {
37 if (serviceName != null) {
38 for (Token ident : tokens) {
39 if (serviceName.equals(ident.getService()) &&
40 AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE.equals(ident.getKind())) {
41 return (Token<AuthenticationTokenIdentifier>)ident;
42 }
43 }
44 }
45 return null;
46 }
47 }