Example usage for com.amazonaws.services.cognitoidp.model GetDeviceRequest setDeviceKey

List of usage examples for com.amazonaws.services.cognitoidp.model GetDeviceRequest setDeviceKey

Introduction

In this page you can find the example usage for com.amazonaws.services.cognitoidp.model GetDeviceRequest setDeviceKey.

Prototype


public void setDeviceKey(String deviceKey) 

Source Link

Document

The device key.

Usage

From source file:io.fineo.client.auth.cognito.CognitoDevice.java

License:Open Source License

/**
 * Internal method to fetch device details.
 *
 * @param session              REQUIRED: A valid {@link CognitoUserSession}.
 * @return/*from  ww w .j ava 2 s .  com*/
 */
private GetDeviceResult getDeviceInternal(CognitoUserSession session) {
    if (session != null && session.isValid()) {
        if (this.deviceKey != null) {
            GetDeviceRequest getDeviceRequest = new GetDeviceRequest();
            getDeviceRequest.setAccessToken(session.getAccessToken().getJWTToken());
            getDeviceRequest.setDeviceKey(this.deviceKey);
            return user.getCognitoIdentityProviderClient().getDevice(getDeviceRequest);
        } else {
            throw new CognitoParameterInvalidException("Device key is null");
        }
    } else {
        throw new CognitoNotAuthorizedException("User is not authorized");
    }
}