Impersontaing options
parent
cf8505b42a
commit
7fd76d96a9
|
|
@ -59,4 +59,7 @@ public class Rsso {
|
||||||
token);
|
token);
|
||||||
return webclient.get().uri(url).retrieve().bodyToMono(RssoResponse.class).block();
|
return webclient.get().uri(url).retrieve().bodyToMono(RssoResponse.class).block();
|
||||||
}
|
}
|
||||||
|
public void impersonateUserFormSession(String userId) throws ARException{
|
||||||
|
javaAPI.impersonateUser(userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.nttdata.calender.api.rsso;
|
package com.nttdata.calender.api.rsso;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
|
@ -15,6 +16,7 @@ import com.bmc.thirdparty.org.springframework.beans.factory.annotation.Autowired
|
||||||
public class RssoInterceptor implements HandlerInterceptor {
|
public class RssoInterceptor implements HandlerInterceptor {
|
||||||
private final static boolean DEBUG = true;
|
private final static boolean DEBUG = true;
|
||||||
private final Rsso rsso;
|
private final Rsso rsso;
|
||||||
|
private static final Logger applicationLogger = LogManager.getLogger("application");
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public RssoInterceptor(Rsso rsso) {
|
public RssoInterceptor(Rsso rsso) {
|
||||||
|
|
@ -42,20 +44,31 @@ public class RssoInterceptor implements HandlerInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
var session = request.getSession(true);
|
var session = request.getSession(true);
|
||||||
var user = session.getAttribute("user");
|
applicationLogger.info("RSSO Interceptor Session:"+session.toString());
|
||||||
if (user == null) {
|
|
||||||
var cookies = request.getCookies();
|
|
||||||
|
|
||||||
|
var user = session.getAttribute("user");
|
||||||
|
applicationLogger.info("\n\n\nRSSO Interceptor user:"+user);
|
||||||
|
System.out.println("USER:"+user);
|
||||||
|
if (user == null) {
|
||||||
|
applicationLogger.info("User ist NULL:");
|
||||||
|
var cookies = request.getCookies();
|
||||||
|
System.out.println("cookies:"+cookies);
|
||||||
|
applicationLogger.info("Cookies:"+cookies.toString());
|
||||||
if (cookies != null) {
|
if (cookies != null) {
|
||||||
for (var cookie : cookies) {
|
for (var cookie : cookies) {
|
||||||
if (cookie.getName().startsWith("sso_")) {
|
if (cookie.getName().startsWith("sso_")||cookie.getName().startsWith("saml_")) {
|
||||||
|
System.out.println("cookie:"+cookie.getName()+"/"+cookie.getValue());
|
||||||
rsso.createSession(cookie.getValue(), session);
|
rsso.createSession(cookie.getValue(), session);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
applicationLogger.info("KEINE COOKIES GESETZT");
|
||||||
|
System.out.println("no cookies");
|
||||||
throw new Exception("no cookies set");
|
throw new Exception("no cookies set");
|
||||||
}
|
}
|
||||||
|
applicationLogger.info("User ist gesetzt:"+ user);
|
||||||
|
rsso.impersonateUserFormSession((String) user);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue