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.oauth2.sdk.device;
019
020
021import com.nimbusds.oauth2.sdk.ErrorObject;
022import com.nimbusds.oauth2.sdk.http.HTTPResponse;
023
024
025/**
026 * OAuth 2.0 Device Authorization Grant specific errors.
027 *
028 * <p>Related specifications:
029 *
030 * <ul>
031 *     <li>OAuth 2.0 Device Authorization Grant (draft-ietf-oauth-device-flow-15)
032 * </ul>
033 */
034public final class DeviceAuthorizationGrantError {
035
036        
037        /**
038         * The authorization request is still pending as the end user hasn't yet
039         * completed the user interaction steps (Section 3.3). The client
040         * SHOULD repeat the Access Token Request to the token endpoint (a
041         * process known as polling). Before each new request the client MUST
042         * wait at least the number of seconds specified by the "interval"
043         * parameter of the Device Authorization Response (see Section 3.2), or
044         * 5 seconds if none was provided, and respect any increase in the
045         * polling interval required by the "slow_down" error.
046         */
047        public static final ErrorObject AUTHORIZATION_PENDING = new ErrorObject("authorization_pending",
048                        "Authorization pending", HTTPResponse.SC_BAD_REQUEST);
049
050
051        /**
052         * A variant of "authorization_pending", the authorization request is
053         * still pending and polling should continue, but the interval MUST be
054         * increased by 5 seconds for this and all subsequent requests.
055         */
056        public static final ErrorObject SLOW_DOWN = new ErrorObject("slow_down", "Slow down",
057                        HTTPResponse.SC_BAD_REQUEST);
058
059
060        /**
061         * The "device_code" has expired and the device flow authorization
062         * session has concluded. The client MAY commence a new Device
063         * Authorization Request but SHOULD wait for user interaction before
064         * restarting to avoid unnecessary polling.
065         */
066        public static final ErrorObject EXPIRED_TOKEN = new ErrorObject("expired_token", "Expired token",
067                        HTTPResponse.SC_BAD_REQUEST);
068
069
070        /**
071         * Prevents public instantiation.
072         */
073        private DeviceAuthorizationGrantError() {
074
075        }
076}