protected boolean checkUserAuthentication(Request request, HttpServletResponse response, FedizContext fedCtx) { // Have we already authenticated someone? Principal principal = request.getUserPrincipal(); // String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE); if (principal != null) { LOG.debug("Already authenticated '{}'", principal.getName()); // Associate the session with any existing SSO session /* * if (ssoId != null) associate(ssoId, request.getSessionInternal(true)); */ if (fedCtx.isDetectExpiredTokens()) { // Check whether security token still valid return validateToken(request, response, fedCtx); } else { LOG.debug("Token expiration not validated."); return true; } } return false; }
protected boolean checkUserAuthentication(Request request, HttpServletResponse response, FedizContext fedCtx) { // Have we already authenticated someone? Principal principal = request.getUserPrincipal(); // String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE); if (principal != null) { LOG.debug("Already authenticated '{}'", principal.getName()); // Associate the session with any existing SSO session /* * if (ssoId != null) associate(ssoId, request.getSessionInternal(true)); */ if (fedCtx.isDetectExpiredTokens()) { // Check whether security token still valid return validateToken(request, response, fedCtx); } else { LOG.debug("Token expiration not validated."); return true; } } return false; }
private boolean isTokenExpired() { SecurityContext context = SecurityContextHolder.getContext(); boolean detectExpiredTokens = federationConfig != null && federationConfig.getFedizContext().isDetectExpiredTokens(); if (context != null && detectExpiredTokens) { Authentication authentication = context.getAuthentication(); if (authentication instanceof FederationAuthenticationToken) { Date tokenExpires = ((FederationAuthenticationToken)authentication).getResponse().getTokenExpires(); if (tokenExpires == null) { return false; } Date currentTime = new Date(); if (currentTime.after(tokenExpires)) { return true; } } } return false; }
private boolean isTokenExpired() { SecurityContext context = SecurityContextHolder.getContext(); boolean detectExpiredTokens = federationConfig != null && federationConfig.getFedizContext().isDetectExpiredTokens(); if (context != null && detectExpiredTokens) { Authentication authentication = context.getAuthentication(); if (authentication instanceof FederationAuthenticationToken) { Date tokenExpires = ((FederationAuthenticationToken)authentication).getResponse().getTokenExpires(); if (tokenExpires == null) { return false; } Date currentTime = new Date(); if (currentTime.after(tokenExpires)) { return true; } } } return false; }
private boolean isTokenExpired(FedizContext fedConfig, UserIdentity userIdentity) { if (fedConfig.isDetectExpiredTokens()) { try { FederationUserIdentity fui = (FederationUserIdentity)userIdentity; Date tokenExpires = fui.getExpiryDate(); if (tokenExpires == null) { LOG.debug("Token doesn't expire"); return false; } Date currentTime = new Date(); if (!currentTime.after(tokenExpires)) { return false; } else { LOG.warn("Token already expired. Clean up and redirect"); return true; } } catch (ClassCastException ex) { LOG.warn("UserIdentity must be instance of FederationUserIdentity"); throw new IllegalStateException("UserIdentity must be instance of FederationUserIdentity"); } } return false; }
private boolean isTokenExpired(FedizContext fedConfig, UserIdentity userIdentity) { if (fedConfig.isDetectExpiredTokens()) { try { FederationUserIdentity fui = (FederationUserIdentity)userIdentity; Date tokenExpires = fui.getExpiryDate(); if (tokenExpires == null) { LOG.debug("Token doesn't expire"); return false; } Date currentTime = new Date(); if (!currentTime.after(tokenExpires)) { return false; } else { LOG.warn("Token already expired. Clean up and redirect"); return true; } } catch (ClassCastException ex) { LOG.warn("UserIdentity must be instance of FederationUserIdentity"); throw new IllegalStateException("UserIdentity must be instance of FederationUserIdentity"); } } return false; }
private boolean isTokenExpired(FedizContext fedConfig, UserIdentity userIdentity) { if (fedConfig.isDetectExpiredTokens()) { try { FederationUserIdentity fui = (FederationUserIdentity)userIdentity; Date tokenExpires = fui.getExpiryDate(); if (tokenExpires == null) { LOG.debug("Token doesn't expire"); return false; } Date currentTime = new Date(); if (!currentTime.after(tokenExpires)) { return false; } else { LOG.warn("Token already expired. Clean up and redirect"); return true; } } catch (ClassCastException ex) { LOG.warn("UserIdentity must be instance of FederationUserIdentity"); throw new IllegalStateException("UserIdentity must be instance of FederationUserIdentity"); } } return false; }
private boolean isTokenExpired() { SecurityContext context = SecurityContextHolder.getContext(); boolean detectExpiredTokens = federationConfig != null && federationConfig.getFedizContext().isDetectExpiredTokens(); if (context != null && detectExpiredTokens) { Authentication authentication = context.getAuthentication(); if (authentication instanceof FederationAuthenticationToken) { Date tokenExpires = ((FederationAuthenticationToken)authentication).getResponse().getTokenExpires(); if (tokenExpires == null) { return false; } Date currentTime = new Date(); if (currentTime.after(tokenExpires)) { return true; } } } return false; }