我们有一个在Caucho Resin上运行的网站.该站点的绝大部分是JSP/Java.我们在网站上拥有自己的自定义身份验证,这意味着我们没有使用任何第三方身份验证框架.我们托管网站,而不是我们的客户.
我们的大客户希望让他们的用户使用他们的活动目录凭据登录我们的站点.为此,我假设我将使用SAML与ADFS对话,如果错误,请纠正我.
所以我的问题是我如何用Java做到这一点?据我所知,OpenSAML听起来并不能完成所有事情,如果我想要更多,那么我需要使用Shibboleth.还有其他选择吗?如果我想要的是用户能够登录,我最好的选择是什么?
任何信息都会有帮助.谢谢.
编辑:我刚刚发现另一种选择是OAuth.优点?缺点?
我有一个ASP.NET application使用基于ADFS的声明基础认证.我还WindowsClaimsIdentity使用Claims to Windows Identity Service 将其映射到a .这很好.
但现在我需要模拟当前的请求/线程,以便我可以访问不是声明感知的服务.我该怎么办?
我应该WindowsImpersonationContext在Application_PostAuthenticate事件中获得一个并将其保存在HttpContext.Items然后在Application_EndRequest调用Undo方法中吗?
或者还有其他首选方式吗?
更新:因为我没有得到任何关于模仿的首选方式的提示我尝试了自己的建议.我在global.asax.cs中创建了这段代码:
private static readonly string WICKey = typeof(System.Security.Principal.WindowsImpersonationContext).AssemblyQualifiedName;
protected void Application_PostAuthenticateRequest()
{
var wid = User.Identity as System.Security.Principal.WindowsIdentity;
if (wid != null)
{
HttpContext.Current.Trace.Write("PostAuthenticateRequest PreImpersonate: " + System.Security.Principal.WindowsIdentity.GetCurrent().Name);
HttpContext.Current.Items[WICKey] = wid.Impersonate();
HttpContext.Current.Trace.Write("PostAuthenticateRequest PostImpersonate: " + System.Security.Principal.WindowsIdentity.GetCurrent().Name);
}
}
protected void Application_EndRequest()
{
var wic = HttpContext.Current.Items[WICKey] as System.Security.Principal.WindowsImpersonationContext;
if (wic != null)
{
HttpContext.Current.Trace.Write("EndRequest PreUndoImpersonate: " …Run Code Online (Sandbox Code Playgroud) 给定一个通过ProcessBuilder创建新进程的Java Servlet(在Windows服务器上运行),我有什么选择让新进程作为调用servlet的原始Web请求的用户运行?
澄清一下,我想要的是类似的东西
ProcessBuilder pb = new ProcessBuilder("whoami");
Process p = pb.start();
// p.getOutputStream() should contain the name of the remote user,
// not the user running the app server
Run Code Online (Sandbox Code Playgroud)
真正的目标是执行一些安全检查(例如,查看用户是否能够打开文件,或在内部企业系统中查看此类记录).
很明显,用户需要通过应用程序服务器或java代码以某种方式进行身份验证 - 理想情况下我希望以某种方式使用单点登录(即没有用户输入密码),这很好如果解决方案仅适用于已登录到域的Windows客户端(如果不是限制,则更好).我目前正在使用Jetty作为应用服务器,但如果有必要,切换到其他东西肯定是一个可行的选择.
(如果它有助于澄清,我基本上希望替换当前使用IIS的模拟功能的CGI脚本在发出请求的用户的上下文中运行)