@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getIdentityId() == null) ? 0 : getIdentityId().hashCode()); hashCode = prime * hashCode + ((getCredentials() == null) ? 0 : getCredentials().hashCode()); return hashCode; }
/** * <p> * Credentials for the provided identity ID. * </p> * * @param credentials * Credentials for the provided identity ID. * @return Returns a reference to this object so that method calls can be chained together. */ public GetCredentialsForIdentityResult withCredentials(Credentials credentials) { setCredentials(credentials); return this; }
/** * <p> * A unique identifier in the format REGION:GUID. * </p> * * @param identityId * A unique identifier in the format REGION:GUID. * @return Returns a reference to this object so that method calls can be chained together. */ public GetCredentialsForIdentityResult withIdentityId(String identityId) { setIdentityId(identityId); return this; }
public GetCredentialsForIdentityResult unmarshall(JsonUnmarshallerContext context) throws Exception { GetCredentialsForIdentityResult getCredentialsForIdentityResult = new GetCredentialsForIdentityResult(); if (context.testExpression("IdentityId", targetDepth)) { context.nextToken(); getCredentialsForIdentityResult.setIdentityId(context.getUnmarshaller(String.class).unmarshall(context)); getCredentialsForIdentityResult.setCredentials(CredentialsJsonUnmarshaller.getInstance().unmarshall(context));
String cognitoIdentityId = "your user's identity id"; String openIdToken = "open id token for the user created on backend"; Map<String,String> logins = new HashMap<>(); logins.put("cognito-identity.amazonaws.com", openIdToken); GetCredentialsForIdentityRequest getCredentialsRequest = new GetCredentialsForIdentityRequest() .withIdentityId(cognitoIdentityId) .withLogins(logins); AmazonCognitoIdentityClient cognitoIdentityClient = new AmazonCognitoIdentityClient(); GetCredentialsForIdentityResult getCredentialsResult = cognitoIdentityClient.getCredentialsForIdentity(getCredentialsRequest); Credentials credentials = getCredentialsResult.getCredentials(); AWSSessionCredentials sessionCredentials = new BasicSessionCredentials( credentials.getAccessKeyId(), credentials.getSecretKey(), credentials.getSessionToken() ); AmazonS3Client s3Client = new AmazonS3Client(sessionCredentials); ...
public GetCredentialsForIdentityResult unmarshall(JsonUnmarshallerContext context) throws Exception { GetCredentialsForIdentityResult getCredentialsForIdentityResult = new GetCredentialsForIdentityResult(); AwsJsonReader reader = context.getReader(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("IdentityId")) { getCredentialsForIdentityResult.setIdentityId(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Credentials")) { getCredentialsForIdentityResult.setCredentials(CredentialsJsonUnmarshaller .getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return getCredentialsForIdentityResult; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetCredentialsForIdentityResult == false) return false; GetCredentialsForIdentityResult other = (GetCredentialsForIdentityResult) obj; if (other.getIdentityId() == null ^ this.getIdentityId() == null) return false; if (other.getIdentityId() != null && other.getIdentityId().equals(this.getIdentityId()) == false) return false; if (other.getCredentials() == null ^ this.getCredentials() == null) return false; if (other.getCredentials() != null && other.getCredentials().equals(this.getCredentials()) == false) return false; return true; }
public GetCredentialsForIdentityResult unmarshall(JsonUnmarshallerContext context) throws Exception { GetCredentialsForIdentityResult getCredentialsForIdentityResult = new GetCredentialsForIdentityResult(); AwsJsonReader reader = context.getReader(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("IdentityId")) { getCredentialsForIdentityResult.setIdentityId(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Credentials")) { getCredentialsForIdentityResult.setCredentials(CredentialsJsonUnmarshaller .getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return getCredentialsForIdentityResult; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getIdentityId() != null) sb.append("IdentityId: ").append(getIdentityId()).append(","); if (getCredentials() != null) sb.append("Credentials: ").append(getCredentials()); sb.append("}"); return sb.toString(); }
public GetCredentialsForIdentityResult unmarshall(JsonUnmarshallerContext context) throws Exception { GetCredentialsForIdentityResult getCredentialsForIdentityResult = new GetCredentialsForIdentityResult(); AwsJsonReader reader = context.getReader(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("IdentityId")) { getCredentialsForIdentityResult.setIdentityId(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Credentials")) { getCredentialsForIdentityResult.setCredentials(CredentialsJsonUnmarshaller .getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return getCredentialsForIdentityResult; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getIdentityId() == null) ? 0 : getIdentityId().hashCode()); hashCode = prime * hashCode + ((getCredentials() == null) ? 0 : getCredentials().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetCredentialsForIdentityResult == false) return false; GetCredentialsForIdentityResult other = (GetCredentialsForIdentityResult) obj; if (other.getIdentityId() == null ^ this.getIdentityId() == null) return false; if (other.getIdentityId() != null && other.getIdentityId().equals(this.getIdentityId()) == false) return false; if (other.getCredentials() == null ^ this.getCredentials() == null) return false; if (other.getCredentials() != null && other.getCredentials().equals(this.getCredentials()) == false) return false; return true; } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getIdentityId() != null) sb.append("IdentityId: " + getIdentityId() + ","); if (getCredentials() != null) sb.append("Credentials: " + getCredentials()); sb.append("}"); return sb.toString(); }
.getCredentials(); sessionCredentials = new BasicSessionCredentials(credentials.getAccessKeyId(), credentials.getSecretKey(), credentials.getSessionToken()); setSessionCredentialsExpiration(credentials.getExpiration()); if (!result.getIdentityId().equals(getIdentityId())) { setIdentityId(result.getIdentityId());
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getIdentityId() == null) ? 0 : getIdentityId().hashCode()); hashCode = prime * hashCode + ((getCredentials() == null) ? 0 : getCredentials().hashCode()); return hashCode; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getIdentityId() == null) ? 0 : getIdentityId().hashCode()); hashCode = prime * hashCode + ((getCredentials() == null) ? 0 : getCredentials().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetCredentialsForIdentityResult == false) return false; GetCredentialsForIdentityResult other = (GetCredentialsForIdentityResult) obj; if (other.getIdentityId() == null ^ this.getIdentityId() == null) return false; if (other.getIdentityId() != null && other.getIdentityId().equals(this.getIdentityId()) == false) return false; if (other.getCredentials() == null ^ this.getCredentials() == null) return false; if (other.getCredentials() != null && other.getCredentials().equals(this.getCredentials()) == false) return false; return true; } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetCredentialsForIdentityResult == false) return false; GetCredentialsForIdentityResult other = (GetCredentialsForIdentityResult) obj; if (other.getIdentityId() == null ^ this.getIdentityId() == null) return false; if (other.getIdentityId() != null && other.getIdentityId().equals(this.getIdentityId()) == false) return false; if (other.getCredentials() == null ^ this.getCredentials() == null) return false; if (other.getCredentials() != null && other.getCredentials().equals(this.getCredentials()) == false) return false; return true; } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getIdentityId() != null) sb.append("IdentityId: " + getIdentityId() + ","); if (getCredentials() != null) sb.append("Credentials: " + getCredentials()); sb.append("}"); return sb.toString(); }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getIdentityId() != null) sb.append("IdentityId: " + getIdentityId() + ","); if (getCredentials() != null) sb.append("Credentials: " + getCredentials()); sb.append("}"); return sb.toString(); }