First page Back Continue Last page Summary Graphics
Login example (cont)
//access authentication service
String userEntry="uid="+userID+userSuffix;
jndiOptions.put(Context.SECURITY_PRINCIPAL,userEntry);
jndiOptions.put(Context.SECURITY_CREDENTIALS,password);
jndiOptions.put(Context.PROVIDER_URL,server);
InitialDirContext ctx=new InitialDirContext(jndiOptions);
//get the principal
principal=
new PrincipalAttributes(userEntry,ctx.getAttributes(""));
}
//handle various exceptions
catch(AuthenticationException e){
exception=e;
throw new FailedLoginException("userID or password is invalid");
}
. . .
return true;
}
Notes: