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.taf;
24 import java.io.IOException;
26 import org.onap.aaf.cadi.Access;
27 import org.onap.aaf.cadi.principal.TaggedPrincipal;
28 import org.onap.aaf.cadi.util.Timing;
30 public class TrustTafResp implements TafResp {
31 private final TafResp delegate;
32 private final TaggedPrincipal principal;
33 private final String desc;
36 public TrustTafResp(final TafResp delegate, final TaggedPrincipal principal, final String desc) {
37 this.delegate = delegate;
38 this.principal = principal;
39 this.desc = desc + ' ' + delegate.desc();
43 public boolean isValid() {
44 return delegate.isValid();
48 public String desc() {
53 public RESP isAuthenticated() {
54 return delegate.isAuthenticated();
58 public RESP authenticate() throws IOException {
59 return delegate.authenticate();
63 public TaggedPrincipal getPrincipal() {
68 * @see org.onap.aaf.cadi.taf.TafResp#getTarget()
71 public String getTarget() {
72 return delegate.getTarget();
76 public Access getAccess() {
77 return delegate.getAccess();
81 public boolean isFailedAttempt() {
82 return delegate.isFailedAttempt();
85 public float timing() {
90 public void timing(long start) {
91 timing = Timing.millis(start);
94 public String toString() {
95 return principal.getName() + " by trust of " + desc();