use of org.everrest.core.tools.SimplePrincipal in project che by eclipse.
the class ServerContainerInitializeListener method createSecurityContext.
protected SecurityContext createSecurityContext(final HandshakeRequest req) {
//todo: get somehow from request
final boolean isSecure = false;
final String authType = "BASIC";
final Subject subject = EnvironmentContext.getCurrent().getSubject();
final Principal principal = new SimplePrincipal(subject.getUserName());
return new SecurityContext() {
@Override
public Principal getUserPrincipal() {
return principal;
}
@Override
public boolean isUserInRole(String role) {
return false;
}
@Override
public boolean isSecure() {
return isSecure;
}
@Override
public String getAuthenticationScheme() {
return authType;
}
};
}
Aggregations