use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.
the class RegisterPasswordResetAuth method doGet.
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response, AuthStep as) throws IOException, ServletException {
HttpSession session = ((HttpServletRequest) request).getSession();
HashMap<String, Attribute> authParams = (HashMap<String, Attribute>) session.getAttribute(ProxyConstants.AUTH_MECH_PARAMS);
UrlHolder holder = (UrlHolder) request.getAttribute(ProxyConstants.AUTOIDM_CFG);
RequestHolder reqHolder = ((AuthController) request.getSession().getAttribute(ProxyConstants.AUTH_CTL)).getHolder();
String urlChain = holder.getUrl().getAuthChain();
AuthChainType act = holder.getConfig().getAuthChains().get(reqHolder.getAuthChainName());
AuthMechType amt = act.getAuthMech().get(as.getId());
AuthController ac = ((AuthController) request.getSession().getAttribute(ProxyConstants.AUTH_CTL));
AuthInfo au = ac.getAuthInfo();
Attribute uid = au.getAttribs().get(this.uidAttribute);
if (uid == null) {
logger.warn("Attribute : '" + this.uidAttribute + "' does not exist");
as.setSuccess(false);
} else {
ResetUserPasswordOnLogout logoutHandler = new ResetUserPasswordOnLogout(this.workflowName, this.uidAttribute, uid.getValues().get(0));
LogoutUtil.insertFirstLogoutHandler(request, logoutHandler);
as.setSuccess(true);
}
holder.getConfig().getAuthManager().nextAuth(request, response, session, false);
}
use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.
the class ResetUserPasswordOnLogout method handleLogout.
@Override
public void handleLogout(HttpServletRequest request, HttpServletResponse response) throws ServletException {
WFCall wfCall = new WFCall();
wfCall.setName(this.workflow);
wfCall.setReason("Logout");
wfCall.setUidAttributeName(this.uidAttributeName);
TremoloUser tu = new TremoloUser();
tu.setUid(this.userID);
tu.getAttributes().add(new Attribute(this.uidAttributeName, this.userID));
wfCall.setUser(tu);
try {
com.tremolosecurity.provisioning.workflow.ExecuteWorkflow exec = new com.tremolosecurity.provisioning.workflow.ExecuteWorkflow();
exec.execute(wfCall, GlobalEntries.getGlobalEntries().getConfigManager());
} catch (Exception e) {
logger.error("Could not update user", e);
}
}
use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.
the class TOTPToken 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 ScaleToken method doFilter.
@Override
public void doFilter(HttpFilterRequest request, HttpFilterResponse response, HttpFilterChain chain) throws Exception {
Gson gson = new Gson();
request.getServletRequest().setAttribute("com.tremolosecurity.unison.proxy.noRedirectOnError", "com.tremolosecurity.unison.proxy.noRedirectOnError");
if (request.getRequestURI().endsWith("/token/config")) {
response.setContentType("application/json");
ScaleJSUtils.addCacheHeaders(response);
response.getWriter().println(gson.toJson(scaleConfig).trim());
} else if (request.getMethod().equalsIgnoreCase("GET") && request.getRequestURI().endsWith("/token/user")) {
AuthInfo userData = ((AuthController) request.getSession().getAttribute(ProxyConstants.AUTH_CTL)).getAuthInfo();
ScaleTokenUser stu = new ScaleTokenUser();
Attribute displayNameAttribute = userData.getAttribs().get(this.scaleConfig.getDisplayNameAttribute());
if (displayNameAttribute != null) {
stu.setDisplayName(displayNameAttribute.getValues().get(0));
} else {
stu.setDisplayName("Unknown");
}
stu.setToken(this.tokenLoader.loadToken(userData, request.getSession()));
ScaleJSUtils.addCacheHeaders(response);
response.setContentType("application/json");
response.getWriter().println(gson.toJson(stu).trim());
}
}
use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.
the class ScaleToken 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;
}
Aggregations