1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * Copyright © 2017 Amdocs
\r
7 * * ===========================================================================
\r
8 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * * you may not use this file except in compliance with the License.
\r
10 * * You may obtain a copy of the License at
\r
12 * * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * * Unless required by applicable law or agreed to in writing, software
\r
15 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * * See the License for the specific language governing permissions and
\r
18 * * limitations under the License.
\r
19 * * ============LICENSE_END====================================================
\r
21 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
23 ******************************************************************************/
\r
24 package com.att.cadi.aaf.cass;
\r
26 import java.security.Principal;
\r
28 import org.apache.cassandra.auth.AuthenticatedUser;
\r
30 import com.att.cadi.Access;
\r
32 public class AAFAuthenticatedUser extends AuthenticatedUser implements Principal {
\r
33 private boolean anonymous = false, supr=false, local=false;
\r
34 private String fullName;
\r
35 // private Access access;
\r
37 public AAFAuthenticatedUser(Access access, String name) {
\r
39 // this.access = access;
\r
40 int endIndex = name.indexOf("@");
\r
44 fullName = name + '@' + AAFBase.default_realm;
\r
48 public String getFullName() {
\r
52 public String getName() {
\r
57 * @see org.apache.cassandra.auth.AuthenticatedUser#isAnonymous()
\r
60 public boolean isAnonymous() {
\r
64 public void setAnonymous(boolean anon) {
\r
68 public boolean getAnonymous() {
\r
73 * @see org.apache.cassandra.auth.AuthenticatedUser#isSuper()
\r
76 public boolean isSuper() {
\r
80 public void setSuper(boolean supr) {
\r
84 public boolean getSuper() {
\r
89 * We check Local so we can compare with the right Lur. This is AAF Plugin only.
\r
92 public boolean isLocal() {
\r
96 public void setLocal(boolean val) {
\r
101 public boolean equals(Object o) {
\r
102 if (this == o) return true;
\r
103 if (!(o instanceof AAFAuthenticatedUser)) return false;
\r
104 return ((AuthenticatedUser)o).getName().equals(this.getName());
\r
108 public int hashCode() {
\r
109 //access.log(Level.DEBUG, "AAFAuthentication hashcode ",getName().hashCode());
\r
110 return getName().hashCode();
\r