Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

Commit

Permalink
merge capability token timestamp fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett Gerry committed Oct 29, 2013
1 parent d029e65 commit 0699477
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions src/classes/TwilioCapability.cls
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ global class TwilioCapability {
this.scopes.add(buildScopeString('stream', 'subscribe', value));
}

<<<<<<< HEAD
/**
* Generates a new token based on the credentials and permissions that
* previously has been granted to this token.
Expand Down Expand Up @@ -142,38 +141,6 @@ global class TwilioCapability {
payload.put('scope', join(this.scopes, ' '));
return jwtEncode(payload, this.authToken);
}
=======
/**
* Generates a new token based on the credentials and permissions that
* previously has been granted to this token.
*
* @return the newly generated token that is valid for 3600 seconds
*/
global String generateToken() {
return generateToken(3600);
}

/**
* Generates a new token based on the credentials and permissions that
* previously has been granted to this token.
*
* @param expiresAt
* the expiration instance of the token.
* @return the newly generated token that is valid for ttl seconds
*/
global String generateToken(long ttl) {
// Build these scopes lazily when we generate tokens so we know
// if we have a default or incoming client name to use
buildIncomingScope();
buildOutgoingScope();
Map<String, Object> payload = new Map<String, Object>();
payload.put('iss', this.accountSid);
payload.put('exp', String.valueOf(System.currentTimeMillis()/1000 + ttl));
payload.put('scope', join(this.scopes, ' '));
return jwtEncode(payload, this.authToken);
}
>>>>>>> 2c915fb8265a9ce66ddd795c4da3e6915d62e809


/* PRIVATE METHODS */

Expand Down

0 comments on commit 0699477

Please sign in to comment.