Message Security Layer (MSL)

com.netflix.msl.userauth
Class UserAuthenticationFactory

java.lang.Object
  extended by com.netflix.msl.userauth.UserAuthenticationFactory
Direct Known Subclasses:
EmailPasswordAuthenticationFactory

public abstract class UserAuthenticationFactory
extends Object

A user authentication factory creates authentication data instances and performs authentication for a specific user authentication scheme.


Field Summary
private  UserAuthenticationScheme scheme
          The factory's user authentication scheme.
 
Constructor Summary
protected UserAuthenticationFactory(UserAuthenticationScheme scheme)
          Create a new user authentication factory for the specified scheme.
 
Method Summary
abstract  MslUser authenticate(MslContext ctx, String identity, UserAuthenticationData data, UserIdToken userIdToken)
          Authenticate the user using the provided authentication data.
abstract  UserAuthenticationData createData(MslContext ctx, MasterToken masterToken, JSONObject userAuthJO)
          Construct a new user authentication data instance from the provided JSON.
 UserAuthenticationScheme getScheme()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scheme

private final UserAuthenticationScheme scheme
The factory's user authentication scheme.

Constructor Detail

UserAuthenticationFactory

protected UserAuthenticationFactory(UserAuthenticationScheme scheme)
Create a new user authentication factory for the specified scheme.

Parameters:
scheme - the user authentication scheme.
Method Detail

getScheme

public UserAuthenticationScheme getScheme()
Returns:
the user authentication scheme this factory is for.

createData

public abstract UserAuthenticationData createData(MslContext ctx,
                                                  MasterToken masterToken,
                                                  JSONObject userAuthJO)
                                           throws MslEncodingException,
                                                  MslUserAuthException,
                                                  MslCryptoException

Construct a new user authentication data instance from the provided JSON.

A master token may be required for certain user authentication schemes.

Parameters:
ctx - MSL context.
masterToken - the entity master token. May be null.
userAuthJO - the JSON object.
Returns:
the user authentication data.
Throws:
MslEncodingException - if there is an error parsing the JSON.
MslUserAuthException - if there is an error creating the user authentication data.
MslCryptoException - if there is an error with the user authentication data cryptography.

authenticate

public abstract MslUser authenticate(MslContext ctx,
                                     String identity,
                                     UserAuthenticationData data,
                                     UserIdToken userIdToken)
                              throws MslUserAuthException,
                                     MslUserIdTokenException

Authenticate the user using the provided authentication data.

If a user ID token is provided then also validate the authenticated user against the provided user ID token. This is typically a check to ensure the user identities are equal but not always. The returned user must be the user identified by the user ID token.

Parameters:
ctx - MSL context.
identity - the entity identity.
data - user authentication data.
userIdToken - user ID token. May be null.
Returns:
the MSL user.
Throws:
MslUserAuthException - if there is an error authenticating the user or if the user authentication data and user ID token identities do not match.
MslUserIdTokenException - if there is a problem with the user ID token.

Message Security Layer (MSL)

Copyright © 2014 Netflix, Inc. All Rights Reserved.