Class StaticBearerTokenAuthenticator
java.lang.Object
org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.lifecycle.Lifecycle
org.eclipse.emf.cdo.server.spi.rest.StaticBearerTokenAuthenticator
- All Implemented Interfaces:
CDORestAuthenticator, org.eclipse.net4j.util.event.INotifier, org.eclipse.net4j.util.event.INotifier.INotifier2, org.eclipse.net4j.util.lifecycle.IDeactivateable, org.eclipse.net4j.util.lifecycle.ILifecycle, org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation
public final class StaticBearerTokenAuthenticator
extends org.eclipse.net4j.util.lifecycle.Lifecycle
implements CDORestAuthenticator
Authenticates opaque bearer tokens against an immutable mapping configured for one repository exposure.
Runtime validation stores only SHA-256 token digests and compares them with MessageDigest.isEqual(byte[], byte[]).
Raw token strings are discarded when the authenticator is first activated. Tokens are operator-provided; this class
does not issue, rotate, refresh, or manage credentials.
- Author:
- Eike Stepper
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.event.Notifier.CancelationNested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle
org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivationNested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier
org.eclipse.net4j.util.event.INotifier.INotifier2 -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAnnotation-factory type for static bearer-token mappings.static final StringManaged-container product group for REST request authenticators.Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
USE_LABEL -
Constructor Summary
ConstructorsConstructorDescriptionStaticBearerTokenAuthenticator(org.eclipse.net4j.util.container.IManagedContainer container, org.eclipse.net4j.util.collection.Tree config) Creates an authenticator from a repository exposure tree. -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(CDORestRequest request, IRepository repository) Authenticates one request for the addressed repository.protected voidprotected voidReturns an optional HTTP authentication challenge for missing or invalid credentials.Returns an optional OpenAPI Security Scheme object for this authenticator.Returns an optional stable name for an OpenAPI security scheme supplied by this authenticator.Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeDeactivate, doCancelActivation, doDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toStringMethods inherited from class org.eclipse.net4j.util.event.Notifier
addListener, addUniqueListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, removeListenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.net4j.util.event.INotifier
addListener, getListeners, hasListeners, removeListener
-
Field Details
-
PRODUCT_GROUP
Managed-container product group for REST request authenticators.- See Also:
-
FACTORY_TYPE
Annotation-factory type for static bearer-token mappings.- See Also:
-
-
Constructor Details
-
StaticBearerTokenAuthenticator
public StaticBearerTokenAuthenticator(org.eclipse.net4j.util.container.IManagedContainer container, org.eclipse.net4j.util.collection.Tree config) Creates an authenticator from a repository exposure tree. Eachtokenchild must define avalueand auserID; both values support the existing CDO container string-conversion facilities.- Parameters:
container- the managed container used for string conversionconfig- the authenticator's XML tree- Throws:
IllegalArgumentException- if any token mapping is incomplete or emptyNullPointerException- if the container or configuration isnull
-
-
Method Details
-
authenticate
Description copied from interface:CDORestAuthenticatorAuthenticates one request for the addressed repository.- Specified by:
authenticatein interfaceCDORestAuthenticator- Parameters:
request- the transport-neutral request, including headers and any trusted transport principalrepository- the repository selected by the request route- Returns:
- the opaque CDO user ID associated with the authenticated caller
-
getChallenge
Description copied from interface:CDORestAuthenticatorReturns an optional HTTP authentication challenge for missing or invalid credentials.- Specified by:
getChallengein interfaceCDORestAuthenticator- Returns:
- a value suitable for
WWW-Authenticate, ornullwhen no challenge applies
-
getOpenAPISecuritySchemeName
Description copied from interface:CDORestAuthenticatorReturns an optional stable name for an OpenAPI security scheme supplied by this authenticator.- Specified by:
getOpenAPISecuritySchemeNamein interfaceCDORestAuthenticator- Returns:
- the scheme name, or
nullwhen this mechanism has no static OpenAPI representation
-
getOpenAPISecurityScheme
Description copied from interface:CDORestAuthenticatorReturns an optional OpenAPI Security Scheme object for this authenticator. The returned map must contain only public scheme metadata and must never contain credentials or secret configuration.- Specified by:
getOpenAPISecuritySchemein interfaceCDORestAuthenticator- Returns:
- an OpenAPI Security Scheme object, or
nullwhen this mechanism has no static representation
-
doBeforeActivate
-
doActivate
-