use of io.helidon.security.spi.SecurityProvider in project helidon by oracle.
the class CompositePolicyConfigTest method initClass.
@BeforeAll
public static void initClass() {
Config config = Config.create();
security = Security.create(config.get("security"));
PathBasedProvider pbp = new PathBasedProvider();
ResourceBasedProvider rbp = new ResourceBasedProvider();
psp = CompositeProviderSelectionPolicy.create(config.get("unit.test")).apply(new ProviderSelectionPolicy.Providers() {
@Override
public <T extends SecurityProvider> List<NamedProvider<T>> getProviders(Class<T> providerType) {
List<NamedProvider<T>> result = new ArrayList<>();
result.add(new NamedProvider<>("first", providerType.cast(pbp)));
result.add(new NamedProvider<>("second", providerType.cast(rbp)));
return result;
}
});
}
use of io.helidon.security.spi.SecurityProvider in project helidon by oracle.
the class CompositePolicyBuilderTest method initClass.
@BeforeAll
public static void initClass() {
PathBasedProvider pbp = new PathBasedProvider();
ResourceBasedProvider rbp = new ResourceBasedProvider();
psp = CompositeProviderSelectionPolicy.builder().addOutboundProvider("first").addOutboundProvider("second").addAuthenticationProvider("first").addAuthenticationProvider("second").addAuthorizationProvider("first", CompositeProviderFlag.OPTIONAL).addAuthorizationProvider("second").build().apply(new ProviderSelectionPolicy.Providers() {
@Override
public <T extends SecurityProvider> List<NamedProvider<T>> getProviders(Class<T> providerType) {
List<NamedProvider<T>> result = new ArrayList<>();
result.add(new NamedProvider<>("first", providerType.cast(pbp)));
result.add(new NamedProvider<>("second", providerType.cast(rbp)));
return result;
}
});
security = Security.builder().addProvider(new PathBasedProvider(), "first").addProvider(new ResourceBasedProvider(), "second").providerSelectionPolicy(CompositeProviderSelectionPolicy.builder().name("composite").isDefault(true).addAuthenticationProvider("first", CompositeProviderFlag.REQUIRED).addAuthenticationProvider("second").addOutboundProvider("first").addOutboundProvider("second").addAuthorizationProvider("first").addAuthorizationProvider("second").build()).build();
}
Aggregations