All,
Can anybody provide advice on how to use the JAAS LoginContext to do an authentication against multiple KDC/Realm combination. In other words, if attempt 1 fails against realm A, try realm B.
Something like the pseudo-code below.
As always, any help is greatly appreciated.
view plaincopy to clipboardprint?
[realms]
some.address.for.auth.one
{
kdc = some.address.one
}
some.address.for.auth.two
{
kdc = some.address.two
}
boolean loginSuccess = false;
try
{
LoginContext lc = new LoginContext(...);
//Try Realm 1
lc.login();
loginSuccess = true;
}
catch(LoginException le)
{
try
{
LoginContext lc2 = new LoginContext(...);
//Try Realm 2
lc2.login();
loginSuccess = true;
}
catch(LoginException le)
{
//...
}
}
return loginSuccess;