这个Waffle SSO的例子是做什么的

Tho*_*rig 6 java kerberos single-sign-on waffle

我正在尝试在Windows上实现SSO(在Java中).最近我发现这个例子完全符合我对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());
}            

...
Run Code Online (Sandbox Code Playgroud)

这个例子很简单,它可以工作,并且接缝可以完全按照我的要求进行操作.但我不明白它是如何工作的.

  • 背景中发生了什么?
  • Waffle是否从Windows获得Kerberos票证?
  • 服务器如何验证客户端的票证?
  • 我是否可以完全信任从服务器上下文执行do循环后获得的用户组?

谢谢.托马斯.

Mar*_*nik 8

Waffle是否从Windows获得Kerberos票证?

Waffle使用Windows SSPI,它代表客户端执行涉及Kerberos票证的所有操作.客户端永远不会看到票证.

服务器如何验证客户端的票证?

这是一个基本的Kerberos问题.发送到服务器的令牌由服务器的密钥加密,该密钥保证令牌是由对客户端进行身份验证的票证授予服务创建的.

我是否可以完全信任从服务器上下文执行do循环后获得的用户组?

是的,从安全令牌中检索.这是MIT Kerberos协议的Windows特定扩展.