java.lang.Object
io.helidon.security.CompositeProviderSelectionPolicy
- All Implemented Interfaces:
ProviderSelectionPolicy
public final class CompositeProviderSelectionPolicy
extends Object
implements ProviderSelectionPolicy
A provider selection policy that supports composing multiple providers (current Authentication and Outbound)
into a single virtual security provider.
Example configuration:
security.provider-policy { type = "COMPOSITE" # explicit name of this policy (to be used when this is not the default or when we want to explicitly reference it) name = "composite" # whether this is the default provider or not (if not, must be explicitly defined by name, if yes, it is returned) default = true authentication: [ { name = "first" flag = "REQUIRED" }, { name = "second" }] outbound: [ { name = "first" }, { name = "second" }] }
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Fluent API builder to createCompositeProviderSelectionPolicy
.Nested classes/interfaces inherited from interface io.helidon.security.spi.ProviderSelectionPolicy
ProviderSelectionPolicy.Providers
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Builder for this selection policy.Load this policy from config.Specific method for outbound providers, as we have an option to choose the first outbound provider that matches the current request.<T extends SecurityProvider>
Optional<T>selectProvider
(Class<T> providerType) Select a provider instance of the type defined that this policy has configured as the default.<T extends SecurityProvider>
Optional<T>selectProvider
(Class<T> providerType, String requestedName) Select a provider instance of the type defined that this policy finds for the requested name.
-
Method Details
-
builder
Builder for this selection policy.- Returns:
- builder instance
-
create
public static Function<ProviderSelectionPolicy.Providers,ProviderSelectionPolicy> create(Config config) Load this policy from config. SeeCompositeProviderSelectionPolicy
for example.- Parameters:
config
- configuration instance- Returns:
- function as expected by
Security.Builder.providerSelectionPolicy(Function)
-
selectProvider
Description copied from interface:ProviderSelectionPolicy
Select a provider instance of the type defined that this policy has configured as the default.- Specified by:
selectProvider
in interfaceProviderSelectionPolicy
- Type Parameters:
T
- type of provider- Parameters:
providerType
- type of provider (one ofAuthenticationProvider
,AuthorizationProvider
)- Returns:
- security provider instance
-
selectOutboundProviders
Description copied from interface:ProviderSelectionPolicy
Specific method for outbound providers, as we have an option to choose the first outbound provider that matches the current request.- Specified by:
selectOutboundProviders
in interfaceProviderSelectionPolicy
- Returns:
- list of outbound provider to choose from (may be empty)
-
selectProvider
public <T extends SecurityProvider> Optional<T> selectProvider(Class<T> providerType, String requestedName) Description copied from interface:ProviderSelectionPolicy
Select a provider instance of the type defined that this policy finds for the requested name.- Specified by:
selectProvider
in interfaceProviderSelectionPolicy
- Type Parameters:
T
- type of provider- Parameters:
providerType
- type of provider (one ofAuthenticationProvider
,AuthorizationProvider
orOutboundSecurityProvider
)requestedName
- explicit provider name to find- Returns:
- security provider instance
-