use of ddf.security.assertion.impl.SecurityAssertionPrincipalDefault in project ddf by codice.
the class GuestInterceptor method handleMessage.
@Override
public void handleMessage(SoapMessage message) throws Fault {
if (message != null) {
HttpServletRequest request = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
LOGGER.debug("Getting new Guest user token");
Principal principal = null;
Subject subject = null;
try {
subject = getSubject(request.getRemoteAddr());
} catch (AuthenticationException e) {
throw new Fault(e);
}
if (subject != null) {
PrincipalCollection principals = subject.getPrincipals();
SecurityAssertion securityAssertion = principals.oneByType(SecurityAssertion.class);
if (securityAssertion != null) {
principal = new SecurityAssertionPrincipalDefault(securityAssertion);
} else {
LOGGER.debug("Subject did not contain a security assertion");
}
message.put(SecurityContext.class, new DefaultSecurityContext(principal, null));
message.put(WSS4J_CHECK_STRING, Boolean.TRUE);
}
} else {
LOGGER.debug("Incoming SOAP message is null - guest interceptor makes no sense.");
}
}
Aggregations