Search in sources :

Example 1 with StreamlinePrincipal

use of com.hortonworks.streamline.streams.security.StreamlinePrincipal in project streamline by hortonworks.

the class StreamlineBasicAuthorizationRequestFilter method filter.

@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
    Map.Entry<String, String> auth = getAuth(requestContext.getHeaders().getFirst("Authorization"));
    if (auth == null) {
        throw new WebserviceAuthorizationException("Not authorized");
    }
    StreamlinePrincipal user = new StreamlinePrincipal(auth.getKey());
    LOG.debug("StreamlinePrincipal: {}", user);
    String scheme = requestContext.getUriInfo().getRequestUri().getScheme();
    requestContext.setSecurityContext(new StreamlineSecurityContext(user, scheme));
}
Also used : WebserviceAuthorizationException(com.hortonworks.streamline.common.exception.service.exception.request.WebserviceAuthorizationException) StreamlinePrincipal(com.hortonworks.streamline.streams.security.StreamlinePrincipal) AbstractMap(java.util.AbstractMap) Map(java.util.Map)

Aggregations

WebserviceAuthorizationException (com.hortonworks.streamline.common.exception.service.exception.request.WebserviceAuthorizationException)1 StreamlinePrincipal (com.hortonworks.streamline.streams.security.StreamlinePrincipal)1 AbstractMap (java.util.AbstractMap)1 Map (java.util.Map)1