public final class Security
extends java.lang.Object
SecurityContext.
It is possible to configure it manually using builder() or use fromConfig(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(),
fromConfig(Config)| Modifier and Type | Class | Description |
|---|---|---|
static class |
Security.Builder |
Builder pattern class for helping create
Security in a convenient way. |
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
HEADER_ORIG_URI |
Integration should add a special header to each request.
|
| Modifier and Type | Method | Description |
|---|---|---|
static Security.Builder |
builder() |
Creates
Security.Builder class. |
static Security.Builder |
builderFromConfig(Config config) |
Creates new instance based on configuration values.
|
SecurityContext.Builder |
contextBuilder(java.lang.String id) |
Create a new security context builder to build and instance.
|
SecurityContext |
createContext(java.lang.String id) |
Create a new security context with the defined id and all defaults.
|
SecurityEnvironment.Builder |
environmentBuilder() |
Security environment builder, to be used to create
environment for evaluating security in integration components.
|
static Security |
fromConfig(Config config) |
Creates new instance based on configuration values.
|
Config |
getConfig(java.lang.String child) |
The configuration of security.
|
java.util.Collection<java.lang.Class<? extends java.lang.annotation.Annotation>> |
getCustomAnnotations() |
Get the complete set of annotations expected by (all) security providers configured.
|
static java.util.Set<java.lang.String> |
getRoles(Subject subject) |
Get a set of roles the subject has, based on
Role. |
SecurityTime |
getServerTime() |
Time that is decisive for the server.
|
java.util.Optional<SubjectMappingProvider> |
getSubjectMapper() |
|
io.opentracing.Tracer |
getTracer() |
Returns a tracer that can be used to construct new spans.
|
public static final java.lang.String HEADER_ORIG_URI
public static Security fromConfig(Config config)
config - Config instancepublic static Security.Builder builderFromConfig(Config config)
config - Config instancepublic static Security.Builder builder()
Security.Builder class.public static java.util.Set<java.lang.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 getServerTime()
SecurityTime may be configured to a fixed point in time, intended for
testing purposes.
public SecurityContext.Builder contextBuilder(java.lang.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(java.lang.String id)
id - id of this contextpublic io.opentracing.Tracer getTracer()
Tracer, may be a no-op tracer if tracing is disabledpublic java.util.Collection<java.lang.Class<? extends java.lang.annotation.Annotation>> getCustomAnnotations()
public Config getConfig(java.lang.String child)
This method will NOT return security internal configuration:
child - the name of the child node to retrieve from configjava.lang.IllegalArgumentException - in case you request child in one of the forbidden treespublic SecurityEnvironment.Builder environmentBuilder()
SecurityEnvironmentpublic java.util.Optional<SubjectMappingProvider> getSubjectMapper()
Copyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.