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. This class is immutable. 011 * 012 * @author Vladimir Dzhuvinov 013 */ 014@Immutable 015public final class GrantType extends Identifier { 016 017 018 /** 019 * Authorisation code. 020 */ 021 public static final GrantType AUTHORIZATION_CODE = new GrantType("authorization_code"); 022 023 024 /** 025 * Implicit. 026 */ 027 public static final GrantType IMPLICIT = new GrantType("implicit"); 028 029 030 /** 031 * Refresh token. 032 */ 033 public static final GrantType REFRESH_TOKEN = new GrantType("refresh_token"); 034 035 036 /** 037 * Password. 038 */ 039 public static final GrantType PASSWORD = new GrantType("password"); 040 041 042 /** 043 * Client credentials. 044 */ 045 public static final GrantType CLIENT_CREDENTIALS = new GrantType("client_credentials"); 046 047 048 /** 049 * Creates a new OAuth 2.0 authorisation grant type with the specified 050 * value. 051 * 052 * @param value The authorisation grant type value. Must not be 053 * {@code null} or empty string. 054 */ 055 public GrantType(final String value) { 056 057 super(value); 058 } 059 060 061 @Override 062 public boolean equals(final Object object) { 063 064 return object instanceof GrantType && 065 this.toString().equals(object.toString()); 066 } 067}