Search in sources :

Example 1 with HttpBasicAuth

use of com.tremolosecurity.proxy.auth.util.HttpBasicAuth in project OpenUnison by TremoloSecurity.

the class RemoteBasic method doFilter.

@Override
public void doFilter(HttpFilterRequest request, HttpFilterResponse response, HttpFilterChain chain) throws Exception {
    HashMap<String, Attribute> authParams = new HashMap<String, Attribute>();
    authParams.put("realmName", new Attribute("realmName", this.realmName));
    authParams.put("uidAttr", new Attribute("uidAttr", "uid"));
    request.getSession().setAttribute(ProxyConstants.AUTH_MECH_PARAMS, authParams);
    AuthStep as = new AuthStep();
    as.setId(0);
    as.setRequired(true);
    if (com.tremolosecurity.proxy.auth.BasicAuth.checkBasicAuth(request.getServletRequest(), response.getServletResponse(), cfgMgr, new HttpBasicAuth(url, false, host, port), as)) {
        request.removeHeader("Authorization");
        chain.nextFilter(request, response, chain);
    } else {
        chain.setNoProxy(true);
    }
}
Also used : HttpBasicAuth(com.tremolosecurity.proxy.auth.util.HttpBasicAuth) Attribute(com.tremolosecurity.saml.Attribute) HashMap(java.util.HashMap) AuthStep(com.tremolosecurity.proxy.auth.util.AuthStep)

Aggregations

AuthStep (com.tremolosecurity.proxy.auth.util.AuthStep)1 HttpBasicAuth (com.tremolosecurity.proxy.auth.util.HttpBasicAuth)1 Attribute (com.tremolosecurity.saml.Attribute)1 HashMap (java.util.HashMap)1