io.quarkus.undertow.runtime.QuarkusUndertowAccount Maven / Gradle / Ivy
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;
}
}