nz.ac.auckland.jetty.RemoteUserIdentity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-jetty8 Show documentation
Show all versions of common-jetty8 Show documentation
This provides commonly used Jetty extensions that are used in the Runnable-War.
The newest version!
package nz.ac.auckland.jetty;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.UserIdentity;
import javax.security.auth.Subject;
import java.security.Principal;
import java.util.List;
import java.util.Set;
public class RemoteUserIdentity implements UserIdentity {
private final Principal user;
private List roles;
private final Request request;
public RemoteUserIdentity(final String username, final Request request) {
this.request = request;
user = new Principal() {
@Override
public String getName() {
return username;
}
};
}
public List getRoles() {
return roles;
}
@Override
public Subject getSubject() {
return null;
}
@Override
public Principal getUserPrincipal() {
return user;
}
@Override
public boolean isUserInRole(String role, Scope scope) {
return RemoteUserUtils.isUserInRole(this, role, scope, request);
}
public void setRoles(List roles) {
this.roles = roles;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy