All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.undertow.runtime.QuarkusUndertowAccount Maven / Gradle / Ivy

There is a newer version: 3.17.0
Show newest version
package io.quarkus.undertow.runtime;

import java.security.Principal;
import java.util.HashSet;
import java.util.Set;

import io.quarkus.security.identity.SecurityIdentity;
import io.undertow.security.idm.Account;

/**
 * An Undertow account implementation that maps to the Elytron {@link SecurityIdentity}
 */
public class QuarkusUndertowAccount implements Account {

    private final SecurityIdentity securityIdentity;

    public QuarkusUndertowAccount(SecurityIdentity securityIdentity) {
        this.securityIdentity = securityIdentity;
    }

    @Override
    public Principal getPrincipal() {
        return securityIdentity.getPrincipal();
    }

    @Override
    public Set getRoles() {
        Set roles = new HashSet<>();
        roles.addAll(securityIdentity.getRoles());
        return roles;
    }

    public SecurityIdentity getSecurityIdentity() {
        return securityIdentity;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy