Package org.wildfly.security.http
Interface HttpScope
-
public interface HttpScopeAn attachment scope for use by an authentication mechanism.Different scopes may be available to share Objects e.g. Application, Session, Connection.
- Author:
- Darran Lofthouse
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default booleanchangeID()Change the ID of this scope.default booleancreate()Create this scope.default booleanexists()Tests whether this scope exists.default ObjectgetAttachment(String key)Get the attachment previously associated with the key specified on this scope.default <T> TgetAttachment(String key, Class<T> type)Get the attachment previously associated with the key specified on this scope and cast it to the type specified.default StringgetID()Get the ID of this scope or (@code null} if IDs are not supported for this scope or the scope doesn't currently exist.default InputStreamgetResource(String path)Get the resource associated with the path specified.default booleaninvalidate()Invalidate this scope.default voidregisterForNotification(Consumer<HttpScopeNotification> notificationConsumer)Register a notification consumer to receive notifications from this scope.default voidsetAttachment(String key, Object value)Set the named attribute on this scope, setting tonullwill clear any value previously set for this key.default booleansupportsAttachments()Tests whether this scope support attachments.default booleansupportsChangeID()Is changing the ID of the scope supported?default booleansupportsInvalidation()Is invalidation supported for this scope?default booleansupportsNotifications()Tests whether this scope support registration to receive notifications.default booleansupportsResources()Tests whether this scope support access to scope specific resources.
-
-
-
Method Detail
-
getID
default String getID()
Get the ID of this scope or (@code null} if IDs are not supported for this scope or the scope doesn't currently exist.- Returns:
- the ID of this scope or (@code null} if IDs are not supported for this scope or the scope doesn't currently exist.
-
exists
default boolean exists()
Tests whether this scope exists.- Returns:
trueif this scope exists. Otherwise,false
-
create
default boolean create()
Create this scope.- Returns:
trueif the scope was created. Otherwise,falseindicating that this scope was already created or that creation is not support.
-
supportsAttachments
default boolean supportsAttachments()
Tests whether this scope support attachments.- Returns:
trueif this scope supports attachments,falseotherwise
-
setAttachment
default void setAttachment(String key, Object value)
Set the named attribute on this scope, setting tonullwill clear any value previously set for this key.- Parameters:
key- the key to use to store the attachment.value- the value to store with the key ornullto clear any previously stored attachment.- Throws:
UnsupportedOperationException- if attachments are not supported.
-
getAttachment
default Object getAttachment(String key)
Get the attachment previously associated with the key specified on this scope.- Parameters:
key- the key used to store the attachment on this scope.- Returns:
- the value associated with the scope or
nullif no association exists. - Throws:
UnsupportedOperationException- if attachments are not supported.
-
getAttachment
default <T> T getAttachment(String key, Class<T> type)
Get the attachment previously associated with the key specified on this scope and cast it to the type specified. This method will only return a value if the attachment exists AND can be cast to the desired type, otherwise it returnsnull.- Parameters:
key- the key used to store the attachment on this scope.type- the desired type of the attachment.- Returns:
- the value associated with the scope or
nullif no association exists or if it could not be converted to the requested type. - Throws:
UnsupportedOperationException- if attachments are not supported.
-
supportsInvalidation
default boolean supportsInvalidation()
Is invalidation supported for this scope?- Returns:
trueif this scope supports invalidation,falseotherwise.
-
invalidate
default boolean invalidate()
Invalidate this scope.- Returns:
trueif invalidation was successful,falseotherwise.
-
supportsChangeID
default boolean supportsChangeID()
Is changing the ID of the scope supported?- Returns:
trueif this scope supports changing the ID,falseotherwise.
-
changeID
default boolean changeID()
Change the ID of this scope.- Returns:
trueif the change was successful,falseotherwise.
-
supportsResources
default boolean supportsResources()
Tests whether this scope support access to scope specific resources.- Returns:
trueif this scope supports access to scope specific resources,falseotherwise.
-
getResource
default InputStream getResource(String path)
Get the resource associated with the path specified.- Parameters:
path- the path to the resource.- Returns:
- the
InputStreamof the resource ornullif resources is not supported or the specified resource is not found.
-
supportsNotifications
default boolean supportsNotifications()
Tests whether this scope support registration to receive notifications.- Returns:
trueif this scope supports registration for notifications,falseotherwise.
-
registerForNotification
default void registerForNotification(Consumer<HttpScopeNotification> notificationConsumer)
Register a notification consumer to receive notifications from this scope.- Parameters:
notificationConsumer- the consumer to receive notifications from this scope.
-
-