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));
}
Aggregations