Java Code Examples for

The following are Jave code examples for showing how to use loginUserFromSubject() of the class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Hydrograph   File:   Source Code and License Vote up 11 votes
 * @param user
 * @param password
 * @param configuration
 * @throws LoginException
 * @throws IOException
private void getKerberosToken(String user, char[] password, Configuration configuration)
        throws LoginException, IOException {
    LOG.trace("Entering method getKerberosToken() for user: " + user);
    URL url = HydrographService.class.getClassLoader().getResource("jaas.conf");
    System.setProperty("", url.toExternalForm());"Generating Kerberos ticket for user: " + user);

    lc = new LoginContext("EntryName", new UserPassCallbackHandler(user, password));

    Subject subject = lc.getSubject();
    Subject.doAs(subject, this);"Kerberos ticket successfully generated for user: " + user);