001/*
002 * oauth2-oidc-sdk
003 *
004 * Copyright 2012-2021, 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.oauth2.sdk.ciba;
019
020import com.nimbusds.oauth2.sdk.ErrorObject;
021import com.nimbusds.oauth2.sdk.http.HTTPResponse;
022
023
024/**
025 * CIBA specific errors.
026 *
027 * <p>Related specifications:
028 *
029 * <ul>
030 *      <li>OpenID Connect CIBA Flow - Core 1.0, sections 12 and 13.
031 * </ul>
032 */
033public final class CIBAError {
034        
035        
036        /**
037         * The {@code login_hint_token} provided in the CIBA request is not
038         * valid because it has expired.
039         */
040        public static final ErrorObject EXPIRED_LOGIN_HINT_TOKEN = new ErrorObject(
041                "expired_login_hint_token",
042                "Expired login_hint_token",
043                HTTPResponse.SC_BAD_REQUEST);
044        
045        
046        /**
047         * The OpenID provider / OAuth 2.0 authorisation server is not able to
048         * identify the end-user by means of the {@code login_hint_token},
049         * {@code id_token_hint} or {@code login_hint} in the provided in the
050         * request.
051         */
052        public static final ErrorObject UNKNOWN_USER_ID = new ErrorObject(
053                "unknown_user_id",
054                "Unknown user ID",
055                HTTPResponse.SC_BAD_REQUEST);
056        
057        
058        /**
059         * A secret {@code user_code} is required but was missing from the
060         * request.
061         */
062        public static final ErrorObject MISSING_USER_CODE = new ErrorObject(
063                "missing_user_code",
064                "Required user_code is missing",
065                HTTPResponse.SC_BAD_REQUEST);
066        
067        
068        /**
069         * The secret {@code user_code} was invalid.
070         */
071        public static final ErrorObject INVALID_USER_CODE = new ErrorObject(
072                "invalid_user_code",
073                "Invalid user_code",
074                HTTPResponse.SC_BAD_REQUEST);
075        
076        
077        /**
078         * The binding message ({@code binding_message}) is invalid or
079         * unacceptable in the given request context.
080         */
081        public static final ErrorObject INVALID_BINDING_MESSAGE = new ErrorObject(
082                "invalid_binding_message",
083                "Invalid or unacceptable binding_message",
084                HTTPResponse.SC_BAD_REQUEST);
085        
086        
087        /**
088         * The {@code auth_req_id} has expired.
089         */
090        public static final ErrorObject EXPIRED_TOKEN = new ErrorObject(
091                "expired_token",
092                "The auth_req_id has expired",
093                0);
094        
095        
096        /**
097         * The transaction failed due to an unexpected condition.
098         */
099        public static final ErrorObject TRANSACTION_FAILED = new ErrorObject(
100                "transaction_failed",
101                "The transaction failed due to an unexpected condition",
102                0);
103        
104        
105        /**
106         * Prevents public instantiation.
107         */
108        private CIBAError() { }
109}