Windows (Java) で SSO を実装しようとしています。最近、この例が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 ループの後に取得したユーザー グループを完全に信頼できますか?
ありがとう。トーマス。