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;
}
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;
}
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);
}
}
}
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);
}
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());
}
}
Aggregations