@Override protected FedizPrincipal createPrincipal(HttpServletRequest request, HttpServletResponse response, FedizResponse wfRes) { // Add "Authenticated" role List<String> roles = wfRes.getRoles(); if (roles == null || roles.isEmpty()) { roles = Collections.singletonList("Authenticated"); } else if (getFedizContext().isAddAuthenticatedRole()) { roles = new ArrayList<>(roles); roles.add("Authenticated"); } // proceed creating the JAAS Subject FedizPrincipal principal = new FederationPrincipalImpl(wfRes.getUsername(), roles, wfRes.getClaims(), wfRes.getToken()); Session session = ((Request)request).getSessionInternal(); // Save the authenticated Principal in our session session.setNote(Constants.FORM_PRINCIPAL_NOTE, principal); // Save Federation response in our session session.setNote(FederationAuthenticator.FEDERATION_NOTE, wfRes); // Save Federation response in public session request.getSession(true).setAttribute(FederationAuthenticator.SECURITY_TOKEN, wfRes.getToken()); LOG.debug("UserPrincipal was created successfully for {}", principal); return principal; }
@Override protected FedizPrincipal createPrincipal(HttpServletRequest request, HttpServletResponse response, FedizResponse wfRes) { // Add "Authenticated" role List<String> roles = wfRes.getRoles(); if (roles == null || roles.isEmpty()) { roles = Collections.singletonList("Authenticated"); } else if (getFedizContext().isAddAuthenticatedRole()) { roles = new ArrayList<>(roles); roles.add("Authenticated"); } // proceed creating the JAAS Subject FedizPrincipal principal = new FederationPrincipalImpl(wfRes.getUsername(), roles, wfRes.getClaims(), wfRes.getToken()); Session session = ((Request)request).getSessionInternal(); // Save the authenticated Principal in our session session.setNote(Constants.FORM_PRINCIPAL_NOTE, principal); // Save Federation response in our session session.setNote(FederationAuthenticator.FEDERATION_NOTE, wfRes); // Save Federation response in public session request.getSession(true).setAttribute(FederationAuthenticator.SECURITY_TOKEN, wfRes.getToken()); LOG.debug("UserPrincipal was created successfully for {}", principal); return principal; }
if (roles == null || roles.isEmpty()) { roles = Collections.singletonList("Authenticated"); } else if (config.isAddAuthenticatedRole()) { roles = new ArrayList<>(roles); roles.add("Authenticated");
if (roles == null || roles.isEmpty()) { roles = Collections.singletonList("Authenticated"); } else if (config.isAddAuthenticatedRole()) { roles = new ArrayList<>(roles); roles.add("Authenticated");