2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2023 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 org.onap.ccsdk.apps.cadi.principal;
24 import java.security.Principal;
26 import org.onap.ccsdk.apps.cadi.UserChain;
28 public class TrustPrincipal extends BearerPrincipal implements UserChain {
29 private final String name;
30 private final Principal original;
31 private String userChain;
33 public TrustPrincipal(final Principal actual, final String asName) {
34 this.original = actual;
36 if (actual instanceof UserChain) {
37 UserChain uc = (UserChain)actual;
38 userChain = uc.userChain();
39 } else if (actual instanceof TaggedPrincipal) {
40 userChain=((TaggedPrincipal)actual).tag();
42 userChain = actual.getClass().getSimpleName();
47 public String getName() {
52 public String userChain() {
56 public Principal original() {
66 public String personalName() {
67 return original.getName() + '[' + userChain + ']';