2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6 * ===========================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
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 * ============LICENSE_END====================================================
22 package com.att.aaf.cadi.cass;
24 import java.security.Principal;
26 import org.apache.cassandra.auth.AuthenticatedUser;
27 import org.onap.aaf.cadi.Access;
29 public class AAFAuthenticatedUser extends AuthenticatedUser implements Principal {
30 private boolean anonymous = false, supr=false, local=false;
31 private String fullName;
32 // private Access access;
34 public AAFAuthenticatedUser(Access access, String name) {
36 // this.access = access;
37 int endIndex = name.indexOf("@");
41 fullName = name + '@' + AAFBase.default_realm;
45 public String getFullName() {
49 public String getName() {
54 * @see org.apache.cassandra.auth.AuthenticatedUser#isAnonymous()
57 public boolean isAnonymous() {
61 public void setAnonymous(boolean anon) {
65 public boolean getAnonymous() {
70 * @see org.apache.cassandra.auth.AuthenticatedUser#isSuper()
73 public boolean isSuper() {
77 public void setSuper(boolean supr) {
81 public boolean getSuper() {
86 * We check Local so we can compare with the right Lur. This is AAF Plugin only.
89 public boolean isLocal() {
93 public void setLocal(boolean val) {
98 public boolean equals(Object o) {
99 if (this == o) return true;
100 if (!(o instanceof AAFAuthenticatedUser)) return false;
101 return ((AuthenticatedUser)o).getName().equals(this.getName());
105 public int hashCode() {
106 //access.log(Level.DEBUG, "AAFAuthentication hashcode ",getName().hashCode());
107 return getName().hashCode();