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 org.onap.aaf.cadi.client;
24 import java.security.Principal;
26 import org.onap.aaf.cadi.SecuritySetter;
27 import org.onap.aaf.cadi.config.SecurityInfoC;
28 import org.onap.aaf.cadi.principal.TaggedPrincipal;
31 * This client represents the ability to Transfer the Identity of the caller to the authenticated
32 * user being transferred to. This ability is critical for App-to-App communication to ensure that
33 * Authorization can happen on the End-Users' credentials when appropriate, even though Authentication
34 * to App1 by App2 must be by App2's credentials.
40 public abstract class AbsTransferSS<CLIENT> implements SecuritySetter<CLIENT> {
41 protected String value;
42 protected SecurityInfoC<CLIENT> securityInfo;
43 protected SecuritySetter<CLIENT> defSS;
44 private Principal principal;
46 //Format:<ID>:<APP>:<protocol>[:AS][,<ID>:<APP>:<protocol>]*
47 public AbsTransferSS(TaggedPrincipal principal, String app) {
51 public AbsTransferSS(TaggedPrincipal principal, String app, SecurityInfoC<CLIENT> si) {
54 this.defSS = si.defSS;
57 private void init(TaggedPrincipal principal, String app) {
58 this.principal=principal;
62 value = principal.getName() + ':' +
64 principal.tag() + ':' +
70 * @see org.onap.aaf.cadi.SecuritySetter#getID()
73 public String getID() {
74 return principal==null?"":principal.getName();