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.CadiException;
28 import org.onap.aaf.cadi.principal.TaggedPrincipal;
31 * Response from Taf objects, which inform users what has happened and/or what should be done
36 public interface TafResp {
37 public static enum RESP {
39 NO_FURTHER_PROCESSING,
43 // A note was made to avoid the response REDIRECT. However, I have deemed that it is
44 // unavoidable when the underlying TAF did do a REDIRECT, because it requires a HTTP
45 // Service code to exit without modifying the Response any further.
46 // Therefore, I have changed this to indicate what HAS happened, with should accommodate
47 // both positions. Jonathan 10/18/2012
48 // public static final int HTTP_REDIRECT_INVOKED = 11;
49 HTTP_REDIRECT_INVOKED,
56 public boolean isValid();
59 * String description of what has occurred (for logging/exceptions)
68 public RESP isAuthenticated();
71 * Authenticate, returning FAIL or Other Valid indication
73 * HTTP implementations should watch for "HTTP_REDIRECT_INVOKED", and end the HTTP call appropriately.
75 * @throws CadiException
77 public RESP authenticate() throws IOException;
80 * Once authenticated, this object should hold a Principal created from the authorization
83 public TaggedPrincipal getPrincipal();
85 /** Target - when Authentication Fails, need to know what ID was being attempted
88 public String getTarget();
91 * get the Access object which created this object, allowing the responder to appropriate Log, etc
93 public Access getAccess();
96 * Be able to check if part of a Failed attempt
98 public boolean isFailedAttempt();
101 * report how long this took
104 public float timing();
107 * Set end of timing in Millis, given Nanos
110 void timing(long start);