public abstract class AbstractAuthenticationProvider extends Object implements AuthenticationProvider
AuthenticationProvider.getIdentifier()
, but otherwise need only override an implemented
function if they wish to actually implement the functionality defined for
that function by the AuthenticationProvider interface.Constructor and Description |
---|
AbstractAuthenticationProvider() |
Modifier and Type | Method and Description |
---|---|
AuthenticatedUser |
authenticateUser(Credentials credentials)
Returns an AuthenticatedUser representing the user authenticated by the
given credentials, if any.
|
UserContext |
decorate(UserContext context,
AuthenticatedUser authenticatedUser,
Credentials credentials)
Given a UserContext returned from getUserContext() of a different
AuthenticationProvider, returns a UserContext instance which decorates
(wraps) that UserContext, delegating and overriding implemented
functions as necessary.
|
Object |
getResource()
Returns an arbitrary REST resource representing this
AuthenticationProvider.
|
UserContext |
getUserContext(AuthenticatedUser authenticatedUser)
Returns the UserContext of the user authenticated by the given
credentials.
|
UserContext |
redecorate(UserContext decorated,
UserContext context,
AuthenticatedUser authenticatedUser,
Credentials credentials)
Given a UserContext returned by updateUserContext() of a different
AuthenticationProvider, returns a UserContext instance which decorates
(wraps) that UserContext, delegating and overriding implemented
functions as necessary.
|
void |
shutdown()
Frees all resources associated with this AuthenticationProvider.
|
AuthenticatedUser |
updateAuthenticatedUser(AuthenticatedUser authenticatedUser,
Credentials credentials)
Returns a new or updated AuthenticatedUser for the given credentials
already having produced the given AuthenticatedUser.
|
UserContext |
updateUserContext(UserContext context,
AuthenticatedUser authenticatedUser,
Credentials credentials)
Returns a new or updated UserContext for the given AuthenticatedUser
already having the given UserContext.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getIdentifier
public Object getResource() throws org.apache.guacamole.GuacamoleException
This implementation simply returns null
. Implementations that
wish to expose REST resources which are not specific to a user's session
should override this function.
getResource
in interface AuthenticationProvider
org.apache.guacamole.GuacamoleException
- If the REST resource cannot be returned due to an error.public AuthenticatedUser authenticateUser(Credentials credentials) throws org.apache.guacamole.GuacamoleException
This implementation performs no authentication whatsoever, ignoring
the provided credentials
and simply returning null
. Any
authentication attempt will thus fall through to other
AuthenticationProvider
implementations, perhaps within other
installed extensions, with this AuthenticationProvider
making no
claim regarding the user's identity nor whether the user should be
allowed or disallowed from accessing Guacamole. Implementations that wish
to authenticate users should override this function.
authenticateUser
in interface AuthenticationProvider
credentials
- The credentials to use for authentication.org.apache.guacamole.GuacamoleException
- If an error occurs while authenticating the user, or if access is
temporarily, permanently, or conditionally denied, such as if the
supplied credentials are insufficient or invalid.public AuthenticatedUser updateAuthenticatedUser(AuthenticatedUser authenticatedUser, Credentials credentials) throws org.apache.guacamole.GuacamoleException
This implementation simply returns the provided
authenticatedUser
without modification. Implementations that
wish to update a user's AuthenticatedUser
object with respect to
new Credentials
received in requests which follow the initial,
successful authentication attempt should override this function.
updateAuthenticatedUser
in interface AuthenticationProvider
authenticatedUser
- An AuthenticatedUser object representing the user authenticated by
an arbitrary set of credentials. The AuthenticatedUser may come from
this AuthenticationProvider or any other installed
AuthenticationProvider.credentials
- The credentials to use for authentication.org.apache.guacamole.GuacamoleException
- If an error occurs while updating the AuthenticatedUser.public UserContext getUserContext(AuthenticatedUser authenticatedUser) throws org.apache.guacamole.GuacamoleException
This implementation simply returns null
, effectively allowing
authentication to continue but refusing to provide data for the given
user. Implementations that wish to veto the authentication results of
other AuthenticationProvider
implementations or provide data for
authenticated users should override this function.
getUserContext
in interface AuthenticationProvider
authenticatedUser
- An AuthenticatedUser object representing the user authenticated by
an arbitrary set of credentials. The AuthenticatedUser may come from
this AuthenticationProvider or any other installed
AuthenticationProvider.org.apache.guacamole.GuacamoleException
- If an error occurs while creating the UserContext.public UserContext updateUserContext(UserContext context, AuthenticatedUser authenticatedUser, Credentials credentials) throws org.apache.guacamole.GuacamoleException
This implementation simply returns the provided context
without modification. Implementations that wish to update a user's
UserContext
object with respect to newly-updated
AuthenticatedUser
or Credentials
(such as those received
in requests which follow the initial, successful authentication attempt)
should override this function.
updateUserContext
in interface AuthenticationProvider
context
- The existing UserContext belonging to the user in question.authenticatedUser
- An AuthenticatedUser object representing the user authenticated by
an arbitrary set of credentials. The AuthenticatedUser may come from
this AuthenticationProvider or any other installed
AuthenticationProvider.credentials
- The credentials which were most recently submitted. These are not
guaranteed to be the same as the credentials associated with the
AuthenticatedUser when they originally authenticated.org.apache.guacamole.GuacamoleException
- If an error occurs while updating the UserContext.public UserContext decorate(UserContext context, AuthenticatedUser authenticatedUser, Credentials credentials) throws org.apache.guacamole.GuacamoleException
This implementation simply returns the provided context
without performing any decoration. Implementations that wish to augment
the functionality or data provided by other
AuthenticationProvider
implementations should override this
function.
decorate
in interface AuthenticationProvider
context
- An existing UserContext generated by getUserContext() of a different
AuthenticationProvider.authenticatedUser
- The AuthenticatedUser object representing the user associated with
the given UserContext.credentials
- The credentials which were most recently submitted for the given
AuthenticatedUser. These are not guaranteed to be the same as the
credentials associated with the AuthenticatedUser object, which are
the credentials provided when the user originally authenticated.org.apache.guacamole.GuacamoleException
- If the UserContext cannot be decorated due to an error.public UserContext redecorate(UserContext decorated, UserContext context, AuthenticatedUser authenticatedUser, Credentials credentials) throws org.apache.guacamole.GuacamoleException
This implementation simply invokes
decorate(UserContext,AuthenticatedUser,Credentials)
with the
provided context
, authenticatedUser
, and
credentials
. Implementations which override
decorate(UserContext,AuthenticatedUser,Credentials)
and which
need to update their existing decorated object following possible
updates to the UserContext
or AuthenticatedUser
(rather
than generate an entirely new decorated object) should override this
function.
redecorate
in interface AuthenticationProvider
decorated
- The UserContext returned when decorate() was invoked on this
AuthenticationProvider for the UserContext which was just updated
via a call to updateUserContext().context
- An existing UserContext generated by updateUserContext() of a
different AuthenticationProvider.authenticatedUser
- The AuthenticatedUser object representing the user associated with
the given UserContext.credentials
- The credentials which were most recently submitted for the given
AuthenticatedUser. These are not guaranteed to be the same as the
credentials associated with the AuthenticatedUser object, which are
the credentials provided when the user originally authenticated.org.apache.guacamole.GuacamoleException
- If the UserContext cannot be decorated due to an error.public void shutdown()
This implementation does nothing. Implementations that wish to perform
cleanup tasks when the AuthenticationProvider
is being unloaded
should override this function.
shutdown
in interface AuthenticationProvider
Copyright © 2018. All rights reserved.