Package org.jboss.security.auth.callback

Examples of org.jboss.security.auth.callback.UsernamePasswordHandler


                EntityUtils.consume(entity);

            // Use our custom configuration to avoid reliance on external config
            Configuration.setConfiguration(new Krb5LoginConfiguration());
            // 1. Authenticate to Kerberos.
            final LoginContext lc = new LoginContext(CoreUtils.class.getName(), new UsernamePasswordHandler(user, pass));
            lc.login();

            // 2. Perform the work as authenticated Subject.
            final String responseBody = Subject.doAs(lc.getSubject(), new PrivilegedExceptionAction<String>() {
                public String run() throws Exception {
View Full Code Here


            unauthorizedPageBody = EntityUtils.toString(response.getEntity());

            // Use our custom configuration to avoid reliance on external config
            Configuration.setConfiguration(new Krb5LoginConfiguration());
            // 1. Authenticate to Kerberos.
            final LoginContext lc = new LoginContext(CoreUtils.class.getName(), new UsernamePasswordHandler(user, pass));
            lc.login();

            // 2. Perform the work as authenticated Subject.
            final String responseBody = Subject.doAs(lc.getSubject(), new PrivilegedExceptionAction<String>() {
                public String run() throws Exception {
View Full Code Here

     * Perform the tests using the ClientLoginModule and LoginContext API to set the desired Principal.
     */
    private void callUsingClientLoginModul(String userName, boolean hasRole1, boolean hasRole2) throws Exception {
        LoginContext loginContext = null;
        try {
            loginContext = new LoginContext("foo", new Subject(), new UsernamePasswordHandler(userName, new char[0]),
                    CLIENT_LOGIN_CONFIG);
            loginContext.login();

            // register the client side interceptor
            final Registration clientInterceptorHandler = EJBClientContext.requireCurrent().registerInterceptor(112567,
View Full Code Here

     * Perform the tests using the ClientLoginModule and LoginContext API to set the desired Principal.
     */
    private void callUsingClientLoginModul(String userName, boolean hasRole1, boolean hasRole2) throws Exception {
        LoginContext loginContext = null;
        try {
            loginContext = new LoginContext("foo", new Subject(), new UsernamePasswordHandler(userName, new char[0]),
                    CLIENT_LOGIN_CONFIG);
            loginContext.login();

            // register the client side interceptor
            final Registration clientInterceptorHandler = EJBClientContext.requireCurrent().registerInterceptor(112567,
View Full Code Here

            EntityUtils.consume(entity);

        // Use our custom configuration to avoid reliance on external config
        Configuration.setConfiguration(new Krb5LoginConfiguration());
        // 1. Authenticate to Kerberos.
        final LoginContext lc = new LoginContext(Utils.class.getName(), new UsernamePasswordHandler(user, pass));
        lc.login();

        // 2. Perform the work as authenticated Subject.
        final String responseBody = Subject.doAs(lc.getSubject(), new PrivilegedExceptionAction<String>() {
            public String run() throws Exception {
View Full Code Here

    private void start() throws LoginException, PrivilegedActionException, IOException {
        LOGGER.debug("Starting GSSTestServer - login");
        // Use our custom configuration to avoid reliance on external config
        Configuration.setConfiguration(new Krb5LoginConfiguration(null, null, true));
        // 1. Authenticate to Kerberos.
        final LoginContext lc = new LoginContext("foo", new UsernamePasswordHandler(GSSTestConstants.PRINCIPAL,
                GSSTestConstants.PASSWORD));
        lc.login();
        LOGGER.debug("Authentication succeed");
        // 2. Perform the work as authenticated Subject.
        final String finishMsg = Subject.doAs(lc.getSubject(), new ServerAction());
View Full Code Here

        // Use our custom configuration to avoid reliance on external config
        Configuration.setConfiguration(new Krb5LoginConfiguration());

        // 1. Authenticate to Kerberos.
        final LoginContext lc = new LoginContext(Utils.class.getName(), new UsernamePasswordHandler(user, pass));
        lc.login();

        // 2. Perform the work as authenticated Subject.
        final String responseBody = Subject.doAs(lc.getSubject(), new HttpGetInKerberos(uri, idpUri));
        lc.logout();
View Full Code Here

     
            Principal jduke1 = new SimplePrincipal("jduke1");
            SecurityAssociation.setPrincipal(jduke1);
            SecurityAssociation.setCredential("theduke1");
     
            UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke2",
               "theduke2");
            LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
            lc.login();
            Subject subject = lc.getSubject();
            System.out.println("LC.Subject: "+subject);
View Full Code Here

            Principal jduke2 = new SimplePrincipal("jduke2");
            Subject subject2 = new Subject();
            SecurityAssociation.pushSubjectContext(subject2, jduke2, "theduke2");

            UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke3",
               "theduke3");
            LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
            lc.login();
            Subject subject = lc.getSubject();
            System.out.println("LC.Subject: "+subject);
View Full Code Here

   }

   public void testSingleThreaded() throws Exception
   {
      System.out.println("+++ testSingleThreaded");
      UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke",
         "theduke");
      LoginContext lc = new LoginContext("testSingleThreaded", handler);
      lc.login();
      Subject subject = lc.getSubject();
      System.out.println("LC.Subject: "+subject);
View Full Code Here

TOP

Related Classes of org.jboss.security.auth.callback.UsernamePasswordHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.