Example usage for com.amazonaws.services.cognitoidentity.model GetOpenIdTokenRequest GetOpenIdTokenRequest

List of usage examples for com.amazonaws.services.cognitoidentity.model GetOpenIdTokenRequest GetOpenIdTokenRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.cognitoidentity.model GetOpenIdTokenRequest GetOpenIdTokenRequest.

Prototype

GetOpenIdTokenRequest

Source Link

Usage

From source file:io.fineo.client.auth.AWSAbstractCognitoIdentityProvider.java

License:Open Source License

/**
 * With the logins and identityId to mark the user, it builds a request to
 * the cognito back end, and returns the token cib hands back
 *//*from  ww w .j a va  2  s .  c  om*/
@Override
public String getToken() {
    if (this.token == null) {
        GetOpenIdTokenRequest getTokenRequest = new GetOpenIdTokenRequest().withIdentityId(getIdentityId())
                .withLogins(loginsMap);

        appendUserAgent(getTokenRequest, getUserAgent());

        GetOpenIdTokenResult getTokenResult = cib.getOpenIdToken(getTokenRequest);

        if (!getTokenResult.getIdentityId().equals(getIdentityId())) {
            identityChanged(getTokenResult.getIdentityId());
        }
        this.token = getTokenResult.getToken();
    }
    return token;
}