|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.springframework.security.oauth2.provider.token.DefaultTokenServices
public class DefaultTokenServices
Base implementation for token services using random UUID values for the access token and refresh token values. The
main extension point for customizations is the TokenEnhancer which will be called after the access and
refresh tokens have been generated but before they are stored.
Persistence is delegated to a TokenStore implementation and customization of the access token to a
TokenEnhancer.
| 构造方法摘要 | |
|---|---|
DefaultTokenServices()
|
|
| 方法摘要 | |
|---|---|
void |
afterPropertiesSet()
Initialize these token services. |
OAuth2AccessToken |
createAccessToken(OAuth2Authentication authentication)
Create an access token associated with the specified credentials. |
Collection<OAuth2AccessToken> |
findTokensByClientId(String clientId)
|
Collection<OAuth2AccessToken> |
findTokensByUserName(String userName)
|
OAuth2AccessToken |
getAccessToken(OAuth2Authentication authentication)
Retrieve an access token stored against the provided authentication key, if it exists. |
protected int |
getAccessTokenValiditySeconds(OAuth2Request clientAuth)
The access token validity period in seconds |
String |
getClientId(String tokenValue)
|
protected int |
getRefreshTokenValiditySeconds(OAuth2Request clientAuth)
The refresh token validity period in seconds |
protected boolean |
isExpired(OAuth2RefreshToken refreshToken)
|
protected boolean |
isSupportRefreshToken(OAuth2Request clientAuth)
Is a refresh token supported for this client (or the global setting if clientDetailsService is not set. |
OAuth2Authentication |
loadAuthentication(String accessTokenValue)
Load the credentials for the specified access token. |
OAuth2AccessToken |
readAccessToken(String accessToken)
Retrieve the full access token details from just the value. |
OAuth2AccessToken |
refreshAccessToken(String refreshTokenValue,
TokenRequest tokenRequest)
Refresh an access token. |
boolean |
revokeToken(String tokenValue)
|
void |
setAccessTokenValiditySeconds(int accessTokenValiditySeconds)
The default validity (in seconds) of the access token. |
void |
setClientDetailsService(ClientDetailsService clientDetailsService)
The client details service to use for looking up clients (if necessary). |
void |
setRefreshTokenValiditySeconds(int refreshTokenValiditySeconds)
The validity (in seconds) of the refresh token. |
void |
setReuseRefreshToken(boolean reuseRefreshToken)
Whether to reuse refresh tokens (until expired). |
void |
setSupportRefreshToken(boolean supportRefreshToken)
Whether to support the refresh token. |
void |
setTokenEnhancer(TokenEnhancer accessTokenEnhancer)
An access token enhancer that will be applied to a new token before it is saved in the token store. |
void |
setTokenStore(TokenStore tokenStore)
The persistence strategy for token storage. |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public DefaultTokenServices()
| 方法详细信息 |
|---|
public void afterPropertiesSet()
throws Exception
org.springframework.beans.factory.InitializingBean 中的 afterPropertiesSetException
public OAuth2AccessToken createAccessToken(OAuth2Authentication authentication)
throws org.springframework.security.core.AuthenticationException
AuthorizationServerTokenServices 复制的描述
AuthorizationServerTokenServices 中的 createAccessTokenauthentication - The credentials associated with the access token.
org.springframework.security.core.AuthenticationException - If the credentials are inadequate.
public OAuth2AccessToken refreshAccessToken(String refreshTokenValue,
TokenRequest tokenRequest)
throws org.springframework.security.core.AuthenticationException
AuthorizationServerTokenServices 复制的描述
AuthorizationServerTokenServices 中的 refreshAccessTokenrefreshTokenValue - The details about the refresh token.tokenRequest - The incoming token request.
org.springframework.security.core.AuthenticationException - If the refresh token is invalid or expired.public OAuth2AccessToken getAccessToken(OAuth2Authentication authentication)
AuthorizationServerTokenServices 复制的描述
AuthorizationServerTokenServices 中的 getAccessTokenauthentication - the authentication key for the access token
protected boolean isExpired(OAuth2RefreshToken refreshToken)
public OAuth2AccessToken readAccessToken(String accessToken)
ResourceServerTokenServices 复制的描述
ResourceServerTokenServices 中的 readAccessTokenaccessToken - the token value
public OAuth2Authentication loadAuthentication(String accessTokenValue)
throws org.springframework.security.core.AuthenticationException
ResourceServerTokenServices 复制的描述
ResourceServerTokenServices 中的 loadAuthenticationaccessTokenValue - The access token value.
org.springframework.security.core.AuthenticationException - If the access token is expiredpublic String getClientId(String tokenValue)
ConsumerTokenServices 中的 getClientIdpublic Collection<OAuth2AccessToken> findTokensByUserName(String userName)
ConsumerTokenServices 中的 findTokensByUserNamepublic Collection<OAuth2AccessToken> findTokensByClientId(String clientId)
ConsumerTokenServices 中的 findTokensByClientIdpublic boolean revokeToken(String tokenValue)
ConsumerTokenServices 中的 revokeTokenprotected int getAccessTokenValiditySeconds(OAuth2Request clientAuth)
authorizationRequest - the current authorization request
protected int getRefreshTokenValiditySeconds(OAuth2Request clientAuth)
authorizationRequest - the current authorization request
protected boolean isSupportRefreshToken(OAuth2Request clientAuth)
clientDetailsService is not set.
authorizationRequest - the current authorization request
public void setTokenEnhancer(TokenEnhancer accessTokenEnhancer)
accessTokenEnhancer - the access token enhancer to setpublic void setRefreshTokenValiditySeconds(int refreshTokenValiditySeconds)
refreshTokenValiditySeconds - The validity (in seconds) of the refresh token.public void setAccessTokenValiditySeconds(int accessTokenValiditySeconds)
accessTokenValiditySeconds - The validity (in seconds) of the access token.public void setSupportRefreshToken(boolean supportRefreshToken)
supportRefreshToken - Whether to support the refresh token.public void setReuseRefreshToken(boolean reuseRefreshToken)
reuseRefreshToken - Whether to reuse refresh tokens (until expired).public void setTokenStore(TokenStore tokenStore)
tokenStore - the store for access and refresh tokens.public void setClientDetailsService(ClientDetailsService clientDetailsService)
setAccessTokenValiditySeconds(int).
clientDetailsService - the client details service
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||