Example usage for org.springframework.security.oauth.provider.token OAuthProviderTokenImpl setVerifier

List of usage examples for org.springframework.security.oauth.provider.token OAuthProviderTokenImpl setVerifier

Introduction

In this page you can find the example usage for org.springframework.security.oauth.provider.token OAuthProviderTokenImpl setVerifier.

Prototype

public void setVerifier(String verifier) 

Source Link

Document

The verifier string for this (access) token.

Usage

From source file:nl.surfnet.coin.api.oauth.OpenConextOauth1TokenServicesTest.java

private OAuthProviderTokenImpl buildToken() {
    final OAuthProviderTokenImpl token = new OAuthProviderTokenImpl();
    token.setValue("value");
    token.setVerifier("verifier");
    token.setSecret("ssh");
    token.setCallbackUrl("callbackurl");
    token.setConsumerKey("consumerkey");
    SAMLAuthenticationToken userAuthentication = new SAMLAuthenticationToken("", Collections.EMPTY_LIST);
    userAuthentication.setClientMetaData(new JanusClientMetadata());
    token.setUserAuthentication(userAuthentication);
    return token;
}

From source file:org.springframework.security.oauth.provider.token.RandomValueProviderTokenServices.java

public void authorizeRequestToken(String requestToken, String verifier, Authentication authentication)
        throws AuthenticationException {
    OAuthProviderTokenImpl tokenImpl = readToken(requestToken);

    if (tokenImpl == null) {
        throw new InvalidOAuthTokenException("Invalid token: " + requestToken);
    } else if (isExpired(tokenImpl)) {
        removeToken(requestToken);//  w w  w.j  a  v a 2  s  .  c  om
        onTokenRemoved(tokenImpl);
        throw new ExpiredOAuthTokenException("Expired token.");
    } else if (tokenImpl.isAccessToken()) {
        throw new InvalidOAuthTokenException("Request to authorize an access token.");
    }

    tokenImpl.setUserAuthentication(authentication);
    tokenImpl.setTimestamp(System.currentTimeMillis());//reset the expiration.
    tokenImpl.setVerifier(verifier);
    storeToken(requestToken, tokenImpl);
}