001package com.pusher.client;
002
003/**
004 * Sigining in as a User on a connection requires authentication.
005 * This interface provides an {@link #authenticate} method as a mechanism
006 * for doing this.
007 *
008 * <p>
009 * See the {@link com.pusher.client.util.HttpUserAuthenticator} as an
010 * example.
011 * </p>
012 */
013public interface UserAuthenticator {
014    /**
015     * Called when a user is to be authenticated.
016     *
017     * @param socketId A unique socket connection ID to be used with the
018     *                 authentication. This uniquely identifies the connection that
019     *                 on which the user is being authenticated.
020     * @return A user authentication token.
021     * @throws AuthenticationFailureException if the authentication fails.
022     */
023    String authenticate(String socketId) throws AuthenticationFailureException;
024}