@Service(value="defaultOAuth2AuthorizationCodeService") public class DefaultOAuth2AuthorizationCodeService extends Object implements org.springframework.security.oauth2.provider.code.AuthorizationCodeServices
Constructor and Description |
---|
DefaultOAuth2AuthorizationCodeService() |
Modifier and Type | Method and Description |
---|---|
void |
clearExpiredAuthorizationCodes()
Find and remove all expired auth codes.
|
org.springframework.security.oauth2.provider.OAuth2Authentication |
consumeAuthorizationCode(String code)
Consume a given authorization code.
|
String |
createAuthorizationCode(org.springframework.security.oauth2.provider.OAuth2Authentication authentication)
Generate a random authorization code and create an AuthorizationCodeEntity,
which will be stored in the repository.
|
int |
getAuthCodeExpirationSeconds() |
AuthorizationCodeRepository |
getRepository() |
void |
setAuthCodeExpirationSeconds(int authCodeExpirationSeconds) |
void |
setRepository(AuthorizationCodeRepository repository) |
public DefaultOAuth2AuthorizationCodeService()
@Transactional(value="defaultTransactionManager") public String createAuthorizationCode(org.springframework.security.oauth2.provider.OAuth2Authentication authentication)
createAuthorizationCode
in interface org.springframework.security.oauth2.provider.code.AuthorizationCodeServices
authentication
- the authentication of the current user, to be retrieved when the
code is consumedpublic org.springframework.security.oauth2.provider.OAuth2Authentication consumeAuthorizationCode(String code) throws org.springframework.security.oauth2.common.exceptions.InvalidGrantException
consumeAuthorizationCode
in interface org.springframework.security.oauth2.provider.code.AuthorizationCodeServices
code
- the authorization codeInvalidGrantException,
- if an AuthorizationCodeEntity is not found with the given valueorg.springframework.security.oauth2.common.exceptions.InvalidGrantException
@Transactional(value="defaultTransactionManager") public void clearExpiredAuthorizationCodes()
public AuthorizationCodeRepository getRepository()
public void setRepository(AuthorizationCodeRepository repository)
repository
- the repository to setpublic int getAuthCodeExpirationSeconds()
public void setAuthCodeExpirationSeconds(int authCodeExpirationSeconds)
authCodeExpirationSeconds
- the authCodeExpirationSeconds to setCopyright © 2018. All rights reserved.