【发布时间】:2013-07-29 07:33:05
【问题描述】:
我正在尝试在 Windows(Java 中)上实现 SSO。最近我发现this example 完全可以用Waffle 做我想做的事情:
// client credentials handle
IWindowsCredentialsHandle credentials= WindowsCredentialsHandleImpl.getCurrent("Negotiate");
credentials.initialize();
// initial client security context
WindowsSecurityContextImpl clientContext = new WindowsSecurityContextImpl();
clientContext.setPrincipalName(Advapi32Util.getUserName());
clientContext.setCredentialsHandle(credentials.getHandle());
clientContext.setSecurityPackage(securityPackage);
clientContext.initialize();
// accept on the server
WindowsAuthProviderImpl provider = new WindowsAuthProviderImpl();
IWindowsSecurityContext serverContext = null;
do {
if (serverContext != null) {
// initialize on the client
SecBufferDesc continueToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, serverContext.getToken());
clientContext.initialize(clientContext.getHandle(), continueToken);
}
// accept the token on the server
serverContext = provider.acceptSecurityToken(clientContext.getToken(), "Negotiate");
} while (clientContext.getContinue() || serverContext.getContinue());
System.out.println(serverContext.getIdentity().getFqn());
for (IWindowsAccount group : serverContext.getIdentity().getGroups()) {
System.out.println(" " + group.getFqn());
}
...
这个例子很简单,它很有效,而且可以完全按照我的意愿去做。但我不明白它是如何工作的。
- 后台发生了什么?
- Waffle 是否从 Windows 获得 Kerberos 票证?
- 服务器如何验证客户端的票据?
- 我可以绝对信任在 do-loop 之后获得的用户组吗 从服务器上下文?
谢谢。托马斯。
【问题讨论】:
-
如果我设置此代码,我添加对 jar 的引用,我能够编译我的 jar,但是在运行时,tomcat 抛出 Advautil32 无法解析,我需要将华夫饼罐放在哪里?谢谢
标签: java single-sign-on kerberos waffle