Search in sources :

Example 76 with Attribute

use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.

the class RemovePrefix method loadOptionalAttributeValue.

private String loadOptionalAttributeValue(String name, String label, HttpFilterConfig config) throws Exception {
    Attribute attr = config.getAttribute(name);
    if (attr == null) {
        logger.warn(label + " not found");
        return null;
    }
    String val = attr.getValues().get(0);
    logger.info(label + ": '" + val + "'");
    return val;
}
Also used : Attribute(com.tremolosecurity.saml.Attribute)

Example 77 with Attribute

use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.

the class RemovePrefix method loadAttributeValue.

private String loadAttributeValue(String name, String label, HttpFilterConfig config) throws Exception {
    Attribute attr = config.getAttribute(name);
    if (attr == null) {
        throw new Exception(label + " not found");
    }
    String val = attr.getValues().get(0);
    logger.info(label + ": '" + val + "'");
    return val;
}
Also used : Attribute(com.tremolosecurity.saml.Attribute)

Example 78 with Attribute

use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.

the class UserToJSON method doFilter.

@Override
public void doFilter(HttpFilterRequest request, HttpFilterResponse response, HttpFilterChain chain) throws Exception {
    HttpSession session = request.getSession();
    AuthController actl = (AuthController) session.getAttribute(ProxyConstants.AUTH_CTL);
    if (actl == null) {
        throw new Exception("No authentication");
    }
    if (actl.getAuthInfo() != null) {
        AuthInfo authInfo = actl.getAuthInfo();
        if (authInfo.getAttribs().containsKey("UserJSON")) {
            authInfo.getAttribs().remove("UserJSON");
        }
        Gson gson = new Gson();
        String ret = gson.toJson(authInfo);
        if (doProxy) {
            chain.setNoProxy(false);
            authInfo.getAttribs().put("UserJSON", new Attribute("UserJSON", ret));
            chain.nextFilter(request, response, chain);
        } else {
            response.addHeader("UserJSON", ret);
            chain.setNoProxy(true);
        }
    }
}
Also used : AuthInfo(com.tremolosecurity.proxy.auth.AuthInfo) Attribute(com.tremolosecurity.saml.Attribute) HttpSession(javax.servlet.http.HttpSession) Gson(com.google.gson.Gson) AuthController(com.tremolosecurity.proxy.auth.AuthController)

Example 79 with Attribute

use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.

the class DecodeLastMile method doFilter.

@Override
public void doFilter(HttpFilterRequest request, HttpFilterResponse response, HttpFilterChain chain) throws Exception {
    SecretKey secret = GlobalEntries.getGlobalEntries().getConfigManager().getSecretKey(this.keyName);
    com.tremolosecurity.lastmile.LastMile lm = new com.tremolosecurity.lastmile.LastMile();
    lm.loadLastMielToken(request.getHeader(this.headerName).getValues().get(0), secret);
    if (!lm.isValid()) {
        throw new Exception("Token not valid");
    }
    for (Attribute attr : lm.getAttributes()) {
        request.getServletRequest().setAttribute(attr.getName(), attr);
    }
    chain.nextFilter(request, response, chain);
}
Also used : SecretKey(javax.crypto.SecretKey) Attribute(com.tremolosecurity.saml.Attribute)

Example 80 with Attribute

use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.

the class HeaderFilter method initFilter.

@Override
public void initFilter(HttpFilterConfig config) throws Exception {
    this.headersToRemove = new HashSet<String>();
    Attribute h2r = config.getAttribute("headerName");
    for (String header : h2r.getValues()) {
        this.headersToRemove.add(header.toLowerCase());
    }
}
Also used : Attribute(com.tremolosecurity.saml.Attribute)

Aggregations

Attribute (com.tremolosecurity.saml.Attribute)268 LDAPAttribute (com.novell.ldap.LDAPAttribute)90 HashMap (java.util.HashMap)89 ProvisioningException (com.tremolosecurity.provisioning.core.ProvisioningException)87 IOException (java.io.IOException)69 ArrayList (java.util.ArrayList)53 LDAPException (com.novell.ldap.LDAPException)51 ServletException (javax.servlet.ServletException)48 AuthInfo (com.tremolosecurity.proxy.auth.AuthInfo)46 AuthController (com.tremolosecurity.proxy.auth.AuthController)45 LDAPEntry (com.novell.ldap.LDAPEntry)43 LDAPSearchResults (com.novell.ldap.LDAPSearchResults)43 HttpSession (javax.servlet.http.HttpSession)40 Gson (com.google.gson.Gson)35 User (com.tremolosecurity.provisioning.core.User)33 HttpServletRequest (javax.servlet.http.HttpServletRequest)33 UrlHolder (com.tremolosecurity.config.util.UrlHolder)31 UnsupportedEncodingException (java.io.UnsupportedEncodingException)30 AuthChainType (com.tremolosecurity.config.xml.AuthChainType)28 HashSet (java.util.HashSet)26