Skip to content

Commit

Permalink
[USERGRID-333] updating Token to accept grant_type of 'client_credent…
Browse files Browse the repository at this point in the history
…ials'
  • Loading branch information
r3b committed Feb 13, 2015
1 parent 8fa14be commit a8ecbc0
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,25 @@ public Token( String username, String password){
*/
public Token(String grantType, String username, String password){
this.put("grant_type",grantType);
this.put("username", username);
this.put("password", password);
if("client_credentials".equals(grantType)){
this.put("client_id", username);
this.put("client_secret", password);
}else{
this.put("username", username);
this.put("password", password);
}
}

public String getAccessToken(){
return (String) this.get("access_token");
}

public String getGrantType(){
return (String) this.get("grant_type");
}

public Long getExpirationDate(){
return (Long) this.get("expires_in");
return ((Integer)this.get("expires_in")).longValue();
}

public Long getPasswordChanged(){
Expand Down

0 comments on commit a8ecbc0

Please sign in to comment.