001/*
002 * oauth2-oidc-sdk
003 *
004 * Copyright 2012-2016, Connect2id Ltd and contributors.
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use
007 * this file except in compliance with the License. You may obtain a copy of the
008 * License at
009 *
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software distributed
013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the
015 * specific language governing permissions and limitations under the License.
016 */
017
018package com.nimbusds.openid.connect.sdk;
019
020
021import com.nimbusds.jwt.JWT;
022import com.nimbusds.oauth2.sdk.Response;
023import com.nimbusds.oauth2.sdk.ResponseMode;
024import com.nimbusds.oauth2.sdk.id.Issuer;
025import com.nimbusds.oauth2.sdk.id.State;
026
027import java.net.URI;
028
029
030/**
031 * OpenID Connect authentication response.
032 *
033 * <p>Related specifications:
034 *
035 * <ul>
036 *     <li>OpenID Connect Core 1.0
037 * </ul>
038 */
039public interface AuthenticationResponse extends Response {
040
041
042        /**
043         * Returns the base redirection URI.
044         *
045         * @return The base redirection URI.
046         */
047        URI getRedirectionURI();
048
049
050        /**
051         * Returns the optional state.
052         *
053         * @return The state, {@code null} if not requested or if the response
054         *         is JWT-secured in which case the state parameter may be
055         *         included as a JWT claim.
056         */
057        State getState();
058
059
060        /**
061         * Returns the optional issuer.
062         *
063         * @return The issuer, {@code null} if not specified.
064         */
065        Issuer getIssuer();
066
067
068        /**
069         * Returns the JSON Web Token (JWT) secured response.
070         *
071         * @return The JWT-secured response, {@code null} for a regular
072         *         authorisation response.
073         */
074        JWT getJWTResponse();
075
076
077        /**
078         * Returns the optional explicit response mode.
079         *
080         * @return The response mode, {@code null} if not specified.
081         */
082        ResponseMode getResponseMode();
083
084
085        /**
086         * Determines the implied response mode.
087         *
088         * @return The implied response mode.
089         */
090        ResponseMode impliedResponseMode();
091        
092        
093        /**
094         * Casts this response to an authentication success response.
095         *
096         * @return The authentication success response.
097         */
098        AuthenticationSuccessResponse toSuccessResponse();
099        
100        
101        /**
102         * Casts this response to an authentication error response.
103         *
104         * @return The authentication error response.
105         */
106        AuthenticationErrorResponse toErrorResponse();
107}