com.stormpath.sdk.impl.oauth.DefaultOAuthClientCredentialsGrantRequestAuthenticationResultBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stormpath-sdk-impl Show documentation
Show all versions of stormpath-sdk-impl Show documentation
The Stormpath Java SDK core implemenation .jar is used at runtime to support API invocations. This
implementation jar should be a runtime dependency only and should NOT be depended on at compile time by
your code. The implementations within this jar can change at any time without warning - use it with runtime
scope only.
package com.stormpath.sdk.impl.oauth;
import com.stormpath.sdk.lang.Assert;
import com.stormpath.sdk.oauth.GrantAuthenticationToken;
/**
* @since 1.0.0
*/
public class DefaultOAuthClientCredentialsGrantRequestAuthenticationResultBuilder extends DefaultOAuthGrantRequestAuthenticationResultBuilder {
public DefaultOAuthClientCredentialsGrantRequestAuthenticationResultBuilder(GrantAuthenticationToken grantAuthenticationToken) {
super(grantAuthenticationToken);
}
@Override
public DefaultOAuthGrantRequestAuthenticationResult build() {
Assert.notNull(this.grantAuthenticationToken, "grantAuthenticationToken has not been set. It is a required attribute.");
this.accessToken = grantAuthenticationToken.getAsAccessToken();
this.accessTokenString = grantAuthenticationToken.getAccessToken();
this.idTokenString = grantAuthenticationToken.getIdToken();
this.accessTokenHref = grantAuthenticationToken.getAccessTokenHref();
this.tokenType = grantAuthenticationToken.getTokenType();
this.expiresIn = Integer.parseInt(grantAuthenticationToken.getExpiresIn());
return new DefaultOAuthGrantRequestAuthenticationResult(this);
}
}