com.linecorp.armeria.server.auth.Authorizer Java Examples

The following examples show how to use com.linecorp.armeria.server.auth.Authorizer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AuthProviderParameters.java    From centraldogma with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param authorizer the {@link Authorizer} which is used to authenticate a session token
 * @param config the configuration for the Central Dogma server
 * @param sessionIdGenerator the session ID generator which must be used when generating a new session ID
 * @param loginSessionPropagator the function which propagates the {@link Session}
 *                               to the other replicas
 * @param logoutSessionPropagator a function which propagates the logged out session ID to the other
 *                                replicas
 */
public AuthProviderParameters(
        Authorizer<HttpRequest> authorizer,
        CentralDogmaConfig config,
        Supplier<String> sessionIdGenerator,
        Function<Session, CompletableFuture<Void>> loginSessionPropagator,
        Function<String, CompletableFuture<Void>> logoutSessionPropagator) {
    this.authorizer = requireNonNull(authorizer, "authorizer");
    this.config = requireNonNull(config, "config");
    this.sessionIdGenerator = requireNonNull(sessionIdGenerator, "sessionIdGenerator");
    this.loginSessionPropagator = requireNonNull(loginSessionPropagator, "loginSessionPropagator");
    this.logoutSessionPropagator = requireNonNull(logoutSessionPropagator, "logoutSessionPropagator");
    authConfig = requireNonNull(config.authConfig(), "authConfig");
}
 
Example #2
Source File: SamlServiceProvider.java    From armeria with Apache License 2.0 5 votes vote down vote up
/**
 * A class which helps a {@link Server} have a SAML-based authentication.
 */
SamlServiceProvider(Authorizer<HttpRequest> authorizer,
                    String entityId,
                    @Nullable String hostname,
                    Credential signingCredential,
                    Credential encryptionCredential,
                    String signatureAlgorithm,
                    SamlPortConfigAutoFiller portConfigAutoFiller,
                    String metadataPath,
                    Map<String, SamlIdentityProviderConfig> idpConfigs,
                    @Nullable SamlIdentityProviderConfig defaultIdpConfig,
                    SamlIdentityProviderConfigSelector idpConfigSelector,
                    Collection<SamlAssertionConsumerConfig> acsConfigs,
                    Collection<SamlEndpoint> sloEndpoints,
                    SamlRequestIdManager requestIdManager,
                    SamlSingleSignOnHandler ssoHandler,
                    SamlSingleLogoutHandler sloHandler) {
    this.authorizer = requireNonNull(authorizer, "authorizer");
    this.entityId = requireNonNull(entityId, "entityId");
    this.hostname = hostname;
    this.signingCredential = requireNonNull(signingCredential, "signingCredential");
    this.encryptionCredential = requireNonNull(encryptionCredential, "encryptionCredential");
    this.signatureAlgorithm = requireNonNull(signatureAlgorithm, "signatureAlgorithm");
    this.portConfigAutoFiller = requireNonNull(portConfigAutoFiller, "portConfigAutoFiller");
    metadataRoute = Route.builder().exact(requireNonNull(metadataPath, "metadataPath")).build();
    this.idpConfigs = ImmutableMap.copyOf(requireNonNull(idpConfigs, "idpConfigs"));
    this.defaultIdpConfig = defaultIdpConfig;
    this.idpConfigSelector = requireNonNull(idpConfigSelector, "idpConfigSelector");
    this.acsConfigs = ImmutableList.copyOf(requireNonNull(acsConfigs, "acsConfigs"));
    this.sloEndpoints = ImmutableList.copyOf(requireNonNull(sloEndpoints, "sloEndpoints"));
    this.requestIdManager = requireNonNull(requestIdManager, "requestIdManager");
    this.ssoHandler = requireNonNull(ssoHandler, "ssoHandler");
    this.sloHandler = requireNonNull(sloHandler, "sloHandler");

    defaultAcsConfig = acsConfigs.stream().filter(SamlAssertionConsumerConfig::isDefault).findFirst()
                                 .orElseThrow(() -> new IllegalArgumentException(
                                         "no default assertion consumer config"));
}
 
Example #3
Source File: AuthProviderParameters.java    From centraldogma with Apache License 2.0 4 votes vote down vote up
/**
 * Returns an {@link Authorizer} which is used to authenticate a session token.
 */
public Authorizer<HttpRequest> authorizer() {
    return authorizer;
}
 
Example #4
Source File: SamlServiceProvider.java    From armeria with Apache License 2.0 4 votes vote down vote up
/**
 * An {@link Authorizer} which authenticates the received {@link HttpRequest}.
 */
Authorizer<HttpRequest> authorizer() {
    return authorizer;
}