agave-apps/clients/AuthService.java
/**
	 * Parses the repsonse json from the auth service into an AuthenticationToken object.
	 * @param response JsonNode object containing the service result attribute value.
	 * @return AuthenticationToken
	 */
Parses the repsonse json from the auth service into an AuthenticationToken object.
@param response JsonNode object containing the service result attribute value.
Parses the repsonse json from the auth service into an AuthenticationToken object . @param response JsonNode object containing the service result attribute value .
private AuthenticationToken parseToken(JsonNode response)
	{
		if (response == null) {
			return null;
		} 
		else 
		{
			AuthenticationToken token = new AuthenticationToken();
			token.setUsername(response.get("username").asText());
			token.setToken(response.get("token").asText());
			if (response.has("internal_username")) {
				token.setInternalUsername(response.get("internal_username").asText());
			}
			token.setLastRenewal(new Date(response.get("renewed").asLong()));
			token.setCreated(new Date(response.get("created").asLong()));
			token.setExpirationDate(new Date(response.get("expires").asLong()));
			if (response.get("remaining_uses").isNumber()) {
				token.setRemainingUses(response.get("remaining_uses").intValue());
			} else {
				token.setRemainingUses(-1);
			}
			return token;
		}
	}
private AuthenticationToken parseToken ( JsonNode response ) { if ( response == null ) { return null ; } else { AuthenticationToken token = new AuthenticationToken ( ) ; token . setUsername ( response . get ( "username" ) . asText ( ) ) ; token . setToken ( response . get ( "token" ) . asText ( ) ) ; if ( response . has ( "internal_username" ) ) { token . setInternalUsername ( response . get ( "internal_username" ) . asText ( ) ) ; } token . setLastRenewal ( new Date ( response . get ( "renewed" ) . asLong ( ) ) ) ; token . setCreated ( new Date ( response . get ( "created" ) . asLong ( ) ) ) ; token . setExpirationDate ( new Date ( response . get ( "expires" ) . asLong ( ) ) ) ; if ( response . get ( "remaining_uses" ) . isNumber ( ) ) { token . setRemainingUses ( response . get ( "remaining_uses" ) . intValue ( ) ) ; } else { token . setRemainingUses ( - 1 ) ; } return token ; } }
Parses the repsonse json from the auth service into an AuthenticationToken object.
Parses the repsonse json from the auth service into an AuthenticationToken object .