@Override public final PolicyContextException authzUnableToObtainPolicyConfiguration(final String contextId, final Throwable cause) { final PolicyContextException result = new PolicyContextException(String.format(getLoggingLocale(), authzUnableToObtainPolicyConfiguration$str(), contextId), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String authzPolicyConfigurationNotInService = "ELY08506: Policy configuration with contextID [%s] is not in service state.";
synchronized ContextPolicy getContextPolicy(String contextID) throws PolicyContextException { ContextPolicy policy = (ContextPolicy) openPolicies.get(contextID); if (policy == null) throw new PolicyContextException("No ContextPolicy exists for contextID=" + contextID); return policy; }
private static HttpSession getHttpSession() { HttpServletRequest httpServletRequest; try { httpServletRequest = (HttpServletRequest) PolicyContext .getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } return httpServletRequest.getSession(); } }
private String getSubject(HttpServletResponse response) throws IOException { try { Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); Set<? extends Principal> principalSet = subject.getPrincipals(JsonWebToken.class); if(principalSet.size() > 0) { return "subject.getPrincipals(JsonWebToken.class) ok"; } response.sendError(500, "subject.getPrincipals(JsonWebToken.class) == 0"); } catch (PolicyContextException e) { e.printStackTrace(); response.sendError(500, e.getMessage()); } throw new IllegalStateException("subject.getPrincipals(JsonWebToken.class) == 0"); } private String callEJB(HttpServletResponse response) throws IOException {
public GeronimoPolicyConfiguration getGeronimoPolicyConfiguration(String contextID) throws PolicyContextException { GeronimoPolicyConfiguration configuration = (GeronimoPolicyConfiguration) configurations.get(contextID); if (configuration == null) { throw new PolicyContextException("No policy configuration registered for contextID: " + contextID); } log.trace("Get policy configuration " + contextID); return configuration; }
public void validateCertificateChain(List<X509Certificate> certificateChain) throws SecurityException { LOG.debug("validate certificate chain: " + certificateChain); HttpServletRequest httpServletRequest; try { httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession httpSession = httpServletRequest.getSession(); httpSession.setAttribute("AuthenticationCertificateChain", certificateChain); } }
public Object getContext(String key, Object data) throws PolicyContextException { try { return ContextManager.getCurrentCaller(); } catch (Exception e) { throw new PolicyContextException(e); } } }
@Override public final PolicyContextException authzUnableToObtainPolicyConfiguration(final String contextId, final Throwable cause) { final PolicyContextException result = new PolicyContextException(String.format(getLoggingLocale(), authzUnableToObtainPolicyConfiguration$str(), contextId), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String authzPolicyConfigurationNotInService = "ELY08506: Policy configuration with contextID [%s] is not in service state.";
public void validateCertificateChain(List<X509Certificate> certificateChain) throws SecurityException { LOG.debug("validate certificate chain: " + certificateChain); HttpServletRequest httpServletRequest; try { httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession httpSession = httpServletRequest.getSession(); httpSession.setAttribute("authenticationCertificateChain", certificateChain); } }
public Object getContext(String key, Object data) throws PolicyContextException { if (key.equals(JACCRoleMapper.HANDLER_KEY)) { try { return ctx.newInstance(new Object[]{SharedState.getLogger()}); } catch (Throwable t) { throw new PolicyContextException(t); } } return null; }
@Override public final PolicyContextException authzUnableToObtainPolicyConfiguration(final String contextId, final Throwable cause) { final PolicyContextException result = new PolicyContextException(String.format(getLoggingLocale(), authzUnableToObtainPolicyConfiguration$str(), contextId), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String authzPolicyConfigurationNotInService = "ELY08506: Policy configuration with contextID [%s] is not in service state.";
private HttpServletRequest getHttpServletRequest() { HttpServletRequest httpServletRequest; try { httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } return httpServletRequest; }
synchronized ContextPolicy getContextPolicy(String contextID) throws PolicyContextException { ContextPolicy policy = openPolicies.get(contextID); if (policy == null) throw new PolicyContextException(PicketBoxMessages.MESSAGES.noPolicyContextForIdMessage(contextID)); return policy; }
@Override public final PolicyContextException authzUnableToObtainPolicyConfiguration(final String contextId, final Throwable cause) { final PolicyContextException result = new PolicyContextException(String.format(getLoggingLocale(), authzUnableToObtainPolicyConfiguration$str(), contextId), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String authzPolicyConfigurationNotInService = "ELY08506: Policy configuration with contextID [%s] is not in service state.";
private HttpSession getHttpSession() { HttpServletRequest httpServletRequest; try { httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession httpSession = httpServletRequest.getSession(); return httpSession; }
protected void validateState(String action) throws PolicyContextException { try { configStateMachine.nextState(action); } catch(IllegalTransitionException e) { log.debug("validateState failure", e); throw new PolicyContextException("Operation not allowed", e); } } }
public X509Certificate getServerCertificate() { LOG.debug("getServerCertificate"); HttpServletRequest httpServletRequest; try { httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession httpSession = httpServletRequest.getSession(); X509Certificate serverCertificate = (X509Certificate) httpSession .getAttribute(SERVER_CERTIFICATE_SESSION_ATTRIBUTE); return serverCertificate; }
private synchronized PolicyConfigurationFactory _getPolicyFactory() throws PolicyContextException { if (pcf == null) { try { pcf = PolicyConfigurationFactory.getPolicyConfigurationFactory(); } catch(ClassNotFoundException cnfe){ logger.log(Level.SEVERE, LogUtils.JACCFACTORY_NOTFOUND); throw new PolicyContextException(cnfe); } catch(PolicyContextException pce){ logger.log(Level.SEVERE, LogUtils.JACCFACTORY_NOTFOUND); throw pce; } } return pcf; }
public void checkNationalRegistrationCertificate(List<X509Certificate> certificateChain) throws SecurityException { LOG.debug("checking national registry certificate..."); HttpServletRequest httpServletRequest; try { httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession httpSession = httpServletRequest.getSession(); X509Certificate certificate = certificateChain.get(0); httpSession.setAttribute("nationalRegistryCertificate", certificate); } }
private synchronized PolicyConfigurationFactory _getPolicyFactory() throws PolicyContextException { if (pcf == null) { try { pcf = PolicyConfigurationFactory.getPolicyConfigurationFactory(); } catch(ClassNotFoundException cnfe){ logger.severe("jaccfactory.notfound"); throw new PolicyContextException(cnfe); } catch(PolicyContextException pce){ logger.severe("jaccfactory.notfound"); throw pce; } } return pcf; }