Package io.helidon.security
Class EndpointConfig
- java.lang.Object
-
- io.helidon.security.EndpointConfig
-
- All Implemented Interfaces:
AbacSupport
public class EndpointConfig extends Object implements AbacSupport
Each endpoint can have security configuration either statically declared (e.g. annotations) or dynamically provided through manual security request. This class covers all kinds of configurations supported:- Annotations as gathered by the integration component (e.g. from Jersey resource class and method)
- Configuration as read from a configuration resource (e.g. when integrating web server)
- Attributes (key/value) configured by a programmer
- Custom objects configured by a programmer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EndpointConfig.AnnotationScope
Scope of annotations used in applications that integrate security.static class
EndpointConfig.Builder
A fluent API builder forEndpointConfig
.-
Nested classes/interfaces inherited from interface io.helidon.security.util.AbacSupport
AbacSupport.BasicAttributes
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Collection<String>
abacAttributeNames()
A collection of all property names in this container.Object
abacAttributeRaw(String key)
Return the actual property value or null if not present.Map<Class<? extends Annotation>,List<Annotation>>
annotations(EndpointConfig.AnnotationScope... scopes)
Deprecated.use iteration over security levels insteadstatic EndpointConfig.Builder
builder()
Creates a fluent API builder to build new instances of this class.<T extends Annotation>
List<T>combineAnnotations(Class<T> annotationClass, EndpointConfig.AnnotationScope... scopes)
Deprecated.use iteration over security levels insteadOptional<Config>
config(String configKey)
GetConfig
instance for a config key.static EndpointConfig
create()
Create an instance of endpoint config with default values (e.g.EndpointConfig.Builder
derive()
Derive a new endpoint configuration builder based on this instance.<U> Optional<U>
instance(Class<U> clazz)
Get an instance of a custom object configuring this endpoint.Collection<Class<?>>
instanceKeys()
Get all classes of custom endpoint configuration object registered.List<SecurityLevel>
securityLevels()
Get all security levels endpoint configuration object registered.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.security.util.AbacSupport
abacAttribute
-
-
-
-
Method Detail
-
builder
public static EndpointConfig.Builder builder()
Creates a fluent API builder to build new instances of this class.- Returns:
- a builder instance
-
create
public static EndpointConfig create()
Create an instance of endpoint config with default values (e.g. all empty).- Returns:
- endpoint config instance
-
abacAttributeRaw
public Object abacAttributeRaw(String key)
Description copied from interface:AbacSupport
Return the actual property value or null if not present. This is the only method that needs to be implemented.- Specified by:
abacAttributeRaw
in interfaceAbacSupport
- Parameters:
key
- key (name) of the property- Returns:
- value of the property or null
-
abacAttributeNames
public Collection<String> abacAttributeNames()
Description copied from interface:AbacSupport
A collection of all property names in this container.- Specified by:
abacAttributeNames
in interfaceAbacSupport
- Returns:
- collection of keys
-
instance
public <U> Optional<U> instance(Class<U> clazz)
Get an instance of a custom object configuring this endpoint.- Type Parameters:
U
- type of the configuration- Parameters:
clazz
- class the instance is bound under (only explicit binding is supported)- Returns:
- instance of the custom object if present
-
instanceKeys
public Collection<Class<?>> instanceKeys()
Get all classes of custom endpoint configuration object registered.- Returns:
- classes that are keys in the custom object store
-
config
public Optional<Config> config(String configKey)
GetConfig
instance for a config key.- Parameters:
configKey
- key of configuration expected- Returns:
- Config instance if present in this endpoint configuration
-
annotations
@Deprecated public Map<Class<? extends Annotation>,List<Annotation>> annotations(EndpointConfig.AnnotationScope... scopes)
Deprecated.use iteration over security levels insteadAll custom annotations for scopes defined in parameters, in the same order.- Parameters:
scopes
- scopes the caller is interested in- Returns:
- a map of annotation classes to annotation instances
- See Also:
SecurityProvider.supportedAnnotations()
-
securityLevels
public List<SecurityLevel> securityLevels()
Get all security levels endpoint configuration object registered. The first level representsEndpointConfig.AnnotationScope.APPLICATION
level annotations. Other levels are representations of each resource and method used on path to get to the target method.- Returns:
- all registered security levels
-
combineAnnotations
@Deprecated public <T extends Annotation> List<T> combineAnnotations(Class<T> annotationClass, EndpointConfig.AnnotationScope... scopes)
Deprecated.use iteration over security levels insteadGet all annotations of a specific class declared on any level.- Type Parameters:
T
- type of annotation wanted- Parameters:
annotationClass
- Class of annotation you wantscopes
- scopes the caller is interested in- Returns:
- list of annotations in order specified by methodFirst parameter
-
derive
public EndpointConfig.Builder derive()
Derive a new endpoint configuration builder based on this instance.- Returns:
- builder to build a modified copy of this endpoint config
-
-