public static Subject generateSecuritySubject ( String jassLoginConfig , String username , String password ) throws LoginException { LoginContext loginCtx = null ; try { // "Client" references the JAAS configuration in the jaas.conf file. loginCtx = new LoginContext ( jassLoginConfig , new Krb5TokenUtils . LoginCallbackHandler ( username , password ) ) ; loginCtx . login ( ) ; log . debug ( " : Krb5Token Kerberos login succeeded against user: %s" , username ) ; return loginCtx . getSubject ( ) ; } catch ( LoginException e ) { log . debug ( " : Krb5Token Kerberos login failed against user: %s" , username ) ; throw e ; } }
Authenticate against the KDC using JAAS .