Class OAuth2AuthorizationResponse
- java.lang.Object
-
- org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationResponse
-
public final class OAuth2AuthorizationResponse extends java.lang.Object
A representation of an OAuth 2.0 Authorization Response for the authorization code grant type.- Since:
- 5.0
- See Also:
OAuth2Error
, Section 4.1.2 Authorization Response
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OAuth2AuthorizationResponse.Builder
A builder forOAuth2AuthorizationResponse
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OAuth2AuthorizationResponse.Builder
error(java.lang.String errorCode)
Returns a newOAuth2AuthorizationResponse.Builder
, initialized with the error code.java.lang.String
getCode()
Returns the authorization code.OAuth2Error
getError()
Returns theOAuth 2.0 Error
if the Authorization Request failed, otherwisenull
.java.lang.String
getRedirectUri()
Returns the uri where the response was redirected to.java.lang.String
getState()
Returns the state.boolean
statusError()
Returnstrue
if the Authorization Request failed, otherwisefalse
.boolean
statusOk()
Returnstrue
if the Authorization Request succeeded, otherwisefalse
.static OAuth2AuthorizationResponse.Builder
success(java.lang.String code)
Returns a newOAuth2AuthorizationResponse.Builder
, initialized with the authorization code.
-
-
-
Method Detail
-
getRedirectUri
public java.lang.String getRedirectUri()
Returns the uri where the response was redirected to.- Returns:
- the uri where the response was redirected to
-
getState
public java.lang.String getState()
Returns the state.- Returns:
- the state
-
getCode
public java.lang.String getCode()
Returns the authorization code.- Returns:
- the authorization code
-
getError
public OAuth2Error getError()
Returns theOAuth 2.0 Error
if the Authorization Request failed, otherwisenull
.- Returns:
- the
OAuth2Error
if the Authorization Request failed, otherwisenull
-
statusOk
public boolean statusOk()
Returnstrue
if the Authorization Request succeeded, otherwisefalse
.- Returns:
true
if the Authorization Request succeeded, otherwisefalse
-
statusError
public boolean statusError()
Returnstrue
if the Authorization Request failed, otherwisefalse
.- Returns:
true
if the Authorization Request failed, otherwisefalse
-
success
public static OAuth2AuthorizationResponse.Builder success(java.lang.String code)
Returns a newOAuth2AuthorizationResponse.Builder
, initialized with the authorization code.- Parameters:
code
- the authorization code- Returns:
- the
OAuth2AuthorizationResponse.Builder
-
error
public static OAuth2AuthorizationResponse.Builder error(java.lang.String errorCode)
Returns a newOAuth2AuthorizationResponse.Builder
, initialized with the error code.- Parameters:
errorCode
- the error code- Returns:
- the
OAuth2AuthorizationResponse.Builder
-
-