@Override public boolean contextHasFormBasedSecurityConstraint(){ if(_contextHasFormBasedSecurityConstraint != null) { return _contextHasFormBasedSecurityConstraint.booleanValue(); } final Context context = (Context)getContainer(); final SecurityConstraint[] constraints = context.findConstraints(); final LoginConfig loginConfig = context.getLoginConfig(); _contextHasFormBasedSecurityConstraint = constraints != null && constraints.length > 0 && loginConfig != null && HttpServletRequest.FORM_AUTH.equals( loginConfig.getAuthMethod() ); return _contextHasFormBasedSecurityConstraint; }
@Override public boolean contextHasFormBasedSecurityConstraint(){ if(_contextHasFormBasedSecurityConstraint != null) { return _contextHasFormBasedSecurityConstraint.booleanValue(); } final Context context = getContext(); final SecurityConstraint[] constraints = context.findConstraints(); final LoginConfig loginConfig = context.getLoginConfig(); _contextHasFormBasedSecurityConstraint = constraints != null && constraints.length > 0 && loginConfig != null && Constants.FORM_METHOD.equals( loginConfig.getAuthMethod() ); return _contextHasFormBasedSecurityConstraint; }
private Map getSharedState(Request request, LoginConfig config) { Map map = new HashMap(); if(config.getAuthMethod().equals(HttpServletRequest.FORM_AUTH)) { map.put("javax.security.auth.login.name", getPrincipal(request.getParameter(Constants.FORM_USERNAME))); map.put("javax.security.auth.login.password", request.getParameter(Constants.FORM_PASSWORD)); } return map; }
private boolean isUserAuthenticated(Request request) { Session sessionInternal = request.getSessionInternal(false); String authMethod = getContext().getLoginConfig().getAuthMethod(); return (authMethod != null && "FORM".equals(authMethod)) && sessionInternal != null && sessionInternal.getNote(Constants.FORM_PRINCIPAL_NOTE) != null; }
private boolean isUserAuthenticated(Request request) { Session sessionInternal = request.getSessionInternal(false); String authMethod = getContext().getLoginConfig().getAuthMethod(); return (authMethod != null && "FORM".equals(authMethod)) && sessionInternal != null && sessionInternal.getNote(Constants.FORM_PRINCIPAL_NOTE) != null; }
private boolean isUserAuthenticated(Request request) { Session sessionInternal = request.getSessionInternal(false); String authMethod = getContext().getLoginConfig().getAuthMethod(); return (authMethod != null && "FORM".equals(authMethod)) && sessionInternal != null && sessionInternal.getNote(Constants.FORM_PRINCIPAL_NOTE) != null; }
LoginConfig config = context.getLoginConfig(); if ((config != null) && (Constants.FORM_METHOD.equals(config.getAuthMethod()))) { loginPage = config.getLoginPage(); errorPage = config.getErrorPage();
protected String determineLoginType(boolean isSecure) { String result = JBossSAMLURIConstants.AC_PASSWORD.get(); LoginConfig loginConfig = getContext().getLoginConfig(); if (loginConfig != null) { String auth = loginConfig.getAuthMethod(); if (StringUtil.isNotNull(auth)) { if ("CLIENT-CERT".equals(auth)) { result = JBossSAMLURIConstants.AC_TLS_CLIENT.get(); } else if (isSecure) { result = JBossSAMLURIConstants.AC_PASSWORD_PROTECTED_TRANSPORT.get(); } } } return result; }
protected String determineLoginType(boolean isSecure) { String result = JBossSAMLURIConstants.AC_PASSWORD.get(); LoginConfig loginConfig = getContext().getLoginConfig(); if (loginConfig != null) { String auth = loginConfig.getAuthMethod(); if (StringUtil.isNotNull(auth)) { if ("CLIENT-CERT".equals(auth)) { result = JBossSAMLURIConstants.AC_TLS_CLIENT.get(); } else if (isSecure) { result = JBossSAMLURIConstants.AC_PASSWORD_PROTECTED_TRANSPORT.get(); } } } return result; }
protected String determineLoginType(boolean isSecure) { String result = JBossSAMLURIConstants.AC_PASSWORD.get(); LoginConfig loginConfig = getContext().getLoginConfig(); if (loginConfig != null) { String auth = loginConfig.getAuthMethod(); if (StringUtil.isNotNull(auth)) { if ("CLIENT-CERT".equals(auth)) { result = JBossSAMLURIConstants.AC_TLS_CLIENT.get(); } else if (isSecure) { result = JBossSAMLURIConstants.AC_PASSWORD_PROTECTED_TRANSPORT.get(); } } } return result; }
if (customAuthenticators != null) { authenticator = (Valve) customAuthenticators.get(loginConfig.getAuthMethod()); authenticators.getProperty(loginConfig.getAuthMethod()); if (authenticatorName == null) { log.error(sm.getString("contextConfig.authenticatorMissing", loginConfig.getAuthMethod())); ok = false; return; log.debug(sm.getString( "contextConfig.authenticatorConfigured", loginConfig.getAuthMethod()));
@Deprecated private static WebConstraint findLegacyConstraints(final Context context, final String[] roles, final String transportGuarantee) { final LoginConfig loginConfig = context.getLoginConfig(); if (loginConfig != null || roles != null || transportGuarantee != null) { final WebConstraint constraint = new WebConstraint() .withAuthMethod(loginConfig != null && !"NONE".equalsIgnoreCase(loginConfig.getAuthMethod()) ? loginConfig.getAuthMethod() : null) .withTransportGuarantee(transportGuarantee) .withRealm(loginConfig != null ? loginConfig.getRealmName() : null) .withRole(roles); for (final Valve valve : context.getPipeline().getValves()) { if (SignatureAuthenticator.class.isInstance(valve) && "SIGNATURE".equals(constraint.getAuthMethod())) { constraint.withMandatoryHeader(SignatureAuthenticator.class.cast(valve).getHeaders().split(" ")); } else if (info(valve).startsWith("com.tomitribe.tribestream.proxy.auth.TokenValve/")) { constraint.withMandatoryHeader(SystemInstance.get().getProperty("tribe.oauth2.auth.header", "Authorization")); if (constraint.getAuthMethod() == null) { constraint.withAuthMethod("JWT"); // virtual auth method but useful information } else { constraint.withAuthMethod(constraint.getAuthMethod() + "+JWT"); } } } return constraint; } return null; }
(org.apache.catalina.realm.Constants.FORM_METHOD.equals(config.getAuthMethod()))) { String requestURI = request.getDecodedRequestURI(); String loginPage = context.getPath() + config.getLoginPage();
if (customAuthenticators != null) { authenticator = (Valve) customAuthenticators.get(loginConfig.getAuthMethod()); authenticators.getProperty(loginConfig.getAuthMethod()); if (authenticatorName == null) { log.error(sm.getString("contextConfig.authenticatorMissing", loginConfig.getAuthMethod())); ok = false; return; log.debug(sm.getString( "contextConfig.authenticatorConfigured", loginConfig.getAuthMethod()));
if (customAuthenticators != null) { authenticator = (Valve) customAuthenticators.get(loginConfig.getAuthMethod()); authenticators.getProperty(loginConfig.getAuthMethod()); if (authenticatorName == null) { log.error(sm.getString("contextConfig.authenticatorMissing", loginConfig.getAuthMethod())); ok = false; return; log.debug(sm.getString( "contextConfig.authenticatorConfigured", loginConfig.getAuthMethod()));
if (customAuthenticators != null) { authenticator = (Valve) customAuthenticators.get(loginConfig.getAuthMethod()); authenticators.getProperty(loginConfig.getAuthMethod()); if (authenticatorName == null) { log.error(sm.getString("contextConfig.authenticatorMissing", loginConfig.getAuthMethod())); ok = false; return; log.debug(sm.getString( "contextConfig.authenticatorConfigured", loginConfig.getAuthMethod()));
if (customAuthenticators != null) { authenticator = (Valve) customAuthenticators.get(loginConfig.getAuthMethod()); authenticators.getProperty(loginConfig.getAuthMethod()); if (authenticatorName == null) { log.error(sm.getString("contextConfig.authenticatorMissing", loginConfig.getAuthMethod())); ok = false; return; log.debug(sm.getString( "contextConfig.authenticatorConfigured", loginConfig.getAuthMethod()));
String authMethod = config.getAuthMethod();
if (customAuthenticators != null) { authenticator = (Valve) customAuthenticators.get(loginConfig.getAuthMethod()); authenticators.getProperty(loginConfig.getAuthMethod()); if (authenticatorName == null) { log.error(sm.getString("contextConfig.authenticatorMissing", loginConfig.getAuthMethod())); ok = false; return; log.debug(sm.getString( "contextConfig.authenticatorConfigured", loginConfig.getAuthMethod()));
@Override protected void authenticatorConfig() { if (!(context instanceof GeronimoStandardContext)) { throw new IllegalStateException("Unexpected context type"); } GeronimoStandardContext geronimoContext = (GeronimoStandardContext) context; if (geronimoContext.isAuthenticatorInstalled()) { return; } if (geronimoContext.getDefaultSubject() == null) { return; } LoginConfig loginConfig = context.getLoginConfig(); if (loginConfig == null) { loginConfig = new LoginConfig(); } String authMethod = loginConfig.getAuthMethod(); String realmName = loginConfig.getRealmName(); String loginPage = loginConfig.getLoginPage(); String errorPage = loginConfig.getErrorPage(); configureSecurity(geronimoContext, geronimoContext.getPolicyContextId(), geronimoContext.getConfigurationFactory(), geronimoContext.getDefaultSubject(), authMethod, realmName, loginPage, errorPage); }