@Override
 public boolean equals(Object other) {
   if (other instanceof UsernameTokenState) {
     UsernameTokenState otherState = (UsernameTokenState) other;
     return Arrays.equals(restUsernameToken.getUsername(), otherState.getUsername())
         && Arrays.equals(restUsernameToken.getPassword(), otherState.getPassword());
   }
   return false;
 }
 public static UsernameTokenState fromJson(JsonValue jsonValue) throws TokenMarshalException {
   try {
     return UsernameTokenState.builder()
         .password(
             jsonValue
                 .get(AMSTSConstants.USERNAME_TOKEN_PASSWORD)
                 .asString()
                 .getBytes(AMSTSConstants.UTF_8_CHARSET_ID))
         .username(
             jsonValue
                 .get(AMSTSConstants.USERNAME_TOKEN_USERNAME)
                 .asString()
                 .getBytes(AMSTSConstants.UTF_8_CHARSET_ID))
         .build();
   } catch (UnsupportedEncodingException e) {
     throw new TokenMarshalException(
         ResourceException.BAD_REQUEST, "Unsupported charset marshalling fromJson: " + e);
   }
 }