com.pusher.client.util
Class HttpAuthorizer

java.lang.Object
  extended by com.pusher.client.util.HttpAuthorizer
All Implemented Interfaces:
Authorizer

public class HttpAuthorizer
extends Object
implements Authorizer

Used to authenticate a private or presence channel subscription.

Makes an HTTP request to a defined HTTP endpoint. Expects an authentication token to be returned.

For more information see the Authenticating Users documentation.


Constructor Summary
HttpAuthorizer(String endPoint)
          Creates a new authorizer.
 
Method Summary
 String authorize(String channelName, String socketId)
          Called when a channel is to be authenticated.
 void setHeaders(HashMap<String,String> headers)
          Set additional headers to be sent as part of the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpAuthorizer

public HttpAuthorizer(String endPoint)
Creates a new authorizer.

Parameters:
endPoint - The endpoint to be called when authenticating.
Method Detail

setHeaders

public void setHeaders(HashMap<String,String> headers)
Set additional headers to be sent as part of the request.

Parameters:
headers -

authorize

public String authorize(String channelName,
                        String socketId)
                 throws AuthorizationFailureException
Description copied from interface: Authorizer
Called when a channel is to be authenticated.

Specified by:
authorize in interface Authorizer
Parameters:
channelName - The name of the channel to be authenticated.
socketId - A unique socket connection ID to be used with the authentication. This uniquely identifies the connection that the subscription is being authenticated for.
Returns:
An authentication token.
Throws:
AuthorizationFailureException - if the authentication fails.


Copyright © 2013 Pusher. All Rights Reserved.