public final class Security extends Object
SecurityContext.
It is possible to configure it manually using builder() or use create(Config) to initialize using
configuration support.
Security is constructed from various providers SecurityProvider and
a selection policy ProviderSelectionPolicy to choose the right one(s) to
secure a request.
builder(),
create(Config)| Modifier and Type | Class and Description |
|---|---|
static class |
Security.Builder
Builder pattern class for helping create
Security in a convenient way. |
| Modifier and Type | Field and Description |
|---|---|
static String |
HEADER_ORIG_URI
Integration should add a special header to each request.
|
| Modifier and Type | Method and Description |
|---|---|
static Security.Builder |
builder()
Creates
Security.Builder class. |
static Security.Builder |
builder(Config config)
Creates new instance based on configuration values.
|
Config |
configFor(String child)
The configuration of security.
|
SecurityContext.Builder |
contextBuilder(String id)
Create a new security context builder to build and instance.
|
static Security |
create(Config config)
Creates new instance based on configuration values.
|
SecurityContext |
createContext(String id)
Create a new security context with the defined id and all defaults.
|
Collection<Class<? extends Annotation>> |
customAnnotations()
Get the complete set of annotations expected by (all) security providers configured.
|
SecurityEnvironment.Builder |
environmentBuilder()
Security environment builder, to be used to create
environment for evaluating security in integration components.
|
static Set<String> |
getRoles(Subject subject)
Get a set of roles the subject has, based on
Role. |
SecurityTime |
serverTime()
Time that is decisive for the server.
|
Optional<SubjectMappingProvider> |
subjectMapper()
Subject mapping provider used to map subject(s) authenticated by
AuthenticationProvider
to a new Subject, e.g. |
Tracer |
tracer()
Returns a tracer that can be used to construct new spans.
|
public static final String HEADER_ORIG_URI
public static Security create(Config config)
config - Config instance located on security configuration ("providers" is an expected child)public static Security.Builder builder(Config config)
config - Config instance located on security configuration ("providers" is an expected child)public static Security.Builder builder()
Security.Builder class.public static Set<String> getRoles(Subject subject)
Role.
This is the set of roles as assumed by authentication provider. Authorization providers may use a different set of
roles (and context used authorization provider to check SecurityContext.isUserInRole(String)).subject - Subject of a user/servicepublic SecurityTime serverTime()
SecurityTime may be configured to a fixed point in time, intended for
testing purposes.
public SecurityContext.Builder contextBuilder(String id)
SecurityContext.logout() to
clear subject and principals.id - to use when logging, auditing etc. (e.g. some kind of tracing id). If none or empty, security instance
UUID will be used (at least to map all audit records for a single instance of security component). If
defined, security will prefix this id with security instance UUIDSecurityContextpublic SecurityContext createContext(String id)
id - id of this contextpublic Tracer tracer()
Tracer, may be a no-op tracer if tracing is disabledpublic Collection<Class<? extends Annotation>> customAnnotations()
public Config configFor(String child)
This method will NOT return security internal configuration:
child - the name of the child node to retrieve from configIllegalArgumentException - in case you request child in one of the forbidden treespublic SecurityEnvironment.Builder environmentBuilder()
SecurityEnvironmentpublic Optional<SubjectMappingProvider> subjectMapper()
AuthenticationProvider
to a new Subject, e.g. to add roles.Copyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.