com.twilio.sdk.client
Class TwilioCapability

java.lang.Object
  extended by com.twilio.sdk.client.TwilioCapability

public class TwilioCapability
extends Object

This class represents a token that will grant someone access to resources within Twilio.


Nested Class Summary
static class TwilioCapability.DomainException
           
 
Constructor Summary
TwilioCapability(String accountSid, String authToken)
          Create a new TwilioCapability with zero permissions.
 
Method Summary
 void allowClientIncoming(String clientName)
          If the user of this token should be allowed to accept incoming connections then configure the TwilioCapability through this method and specify the client name.
 void allowClientOutgoing(String appSid)
          Allow the user of this token to make outgoing connections.
 void allowClientOutgoing(String appSid, Map<String,String> params)
          Allow the user of this token to make outgoing connections.
 void allowEventStream(Map<String,String> filters)
          Allow the user of this token to access their event stream.
 String generateToken()
          Generates a new token based on the credentials and permissions that previously has been granted to this token.
 String generateToken(long ttl)
          Generates a new token based on the credentials and permissions that previously has been granted to this token.
static void main(String[] args)
          Example usage
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwilioCapability

public TwilioCapability(String accountSid,
                        String authToken)
Create a new TwilioCapability with zero permissions. Next steps are to grant access to resources by configuring this token through the functions allowXXXX.

Parameters:
accountSid - the account sid to which this token is granted access
authToken - the secret key used to sign the token. Note, this auth token is not visible to the user of the token.
Method Detail

allowClientOutgoing

public void allowClientOutgoing(String appSid)
Allow the user of this token to make outgoing connections.

Parameters:
appSid - the application to which this token grants access

allowClientOutgoing

public void allowClientOutgoing(String appSid,
                                Map<String,String> params)
Allow the user of this token to make outgoing connections.

Parameters:
appSid - the application to which this token grants access
params - signed parameters that the user of this token cannot overwrite.

allowClientIncoming

public void allowClientIncoming(String clientName)
If the user of this token should be allowed to accept incoming connections then configure the TwilioCapability through this method and specify the client name.

Parameters:
clientName -

allowEventStream

public void allowEventStream(Map<String,String> filters)
Allow the user of this token to access their event stream.

Parameters:
filters - key/value filters to apply to the event stream

generateToken

public String generateToken()
                     throws TwilioCapability.DomainException
Generates a new token based on the credentials and permissions that previously has been granted to this token.

Returns:
the newly generated token that is valid for 3600 seconds
Throws:
TwilioCapability.DomainException

generateToken

public String generateToken(long ttl)
                     throws TwilioCapability.DomainException
Generates a new token based on the credentials and permissions that previously has been granted to this token.

Parameters:
ttl - the number of seconds before this token expires
Returns:
the newly generated token that is valid for ttl seconds
Throws:
TwilioCapability.DomainException

main

public static void main(String[] args)
Example usage

Parameters:
args -


Copyright © 2011 Twilio, Inc. All Rights Reserved.