use of org.finra.gatekeeper.common.authfilter.parser.IGatekeeperUserProfile in project Gatekeeper by FINRAOS.
the class GatekeeperCommonConfig method userProfile.
/* Request scoped bean to create autowireable UserProfile object */
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
public IGatekeeperUserProfile userProfile() {
HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
Principal p = req.getUserPrincipal();
return (IGatekeeperUserProfile) p;
}
use of org.finra.gatekeeper.common.authfilter.parser.IGatekeeperUserProfile in project Gatekeeper by FINRAOS.
the class UserHeaderFilter method doFilter.
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest httpReq = (HttpServletRequest) req;
Optional<IGatekeeperUserProfile> userProfile = userProfileParser.parse(httpReq);
if (userProfile.isPresent()) {
filterChain.doFilter(new UserProfileRequestWrapper(httpReq, userProfile.get()), res);
} else {
filterChain.doFilter(httpReq, res);
}
}
Aggregations