001package com.nimbusds.oauth2.sdk;
002
003
004import net.jcip.annotations.Immutable;
005
006import com.nimbusds.oauth2.sdk.id.Identifier;
007
008
009/**
010 * Authorisation grant type.
011 */
012@Immutable
013public final class GrantType extends Identifier {
014
015        
016        /**
017         * Authorisation code.
018         */
019        public static final GrantType AUTHORIZATION_CODE = new GrantType("authorization_code");
020
021
022        /**
023         * Implicit.
024         */
025        public static final GrantType IMPLICIT = new GrantType("implicit");
026        
027        
028        /**
029         * Refresh token.
030         */
031        public static final GrantType REFRESH_TOKEN = new GrantType("refresh_token");
032
033
034        /**
035         * Password.
036         */
037        public static final GrantType PASSWORD = new GrantType("password");
038
039
040        /**
041         * Client credentials.
042         */
043        public static final GrantType CLIENT_CREDENTIALS = new GrantType("client_credentials");
044
045
046        /**
047         * Creates a new OAuth 2.0 authorisation grant type with the specified
048         * value.
049         *
050         * @param value The authorisation grant type value. Must not be
051         *              {@code null} or empty string.
052         */
053        public GrantType(final String value) {
054
055                super(value);
056        }
057
058
059        @Override
060        public boolean equals(final Object object) {
061        
062                return object instanceof GrantType &&
063                       this.toString().equals(object.toString());
064        }
065}