Package javax.management.remote

Examples of javax.management.remote.JMXPrincipal


    protected void tearDown() throws Exception {
        super.tearDown();
    }
   
    private void createTransportAndConsume( boolean wantAuth, boolean needAuth ) throws IOException {
        JMXPrincipal principal = new JMXPrincipal( certDistinguishedName );
        X509Certificate cert = new StubX509Certificate( principal );
        StubSSLSession sslSession =
            new StubSSLSession( cert );
       
        sslSocket = new StubSSLSocket( sslSession );
View Full Code Here


        // perform authentication
        if (secretInformation.getUser().equals(username) &&
                password.equals(secretInformation.getResolvedSecret())) {
            return new Subject(true,
                Collections.singleton(new JMXPrincipal(username)),
                Collections.EMPTY_SET,
                Collections.EMPTY_SET);
        } else {
            throw new SecurityException("Username and/or password are incorrect, " +
                "or you do not have the necessary access rights.");
View Full Code Here

        }

        try {
            if(authenticator.authenticate(username, password)){
                return new Subject(true,
                                   Collections.singleton(new JMXPrincipal(username)),
                                   Collections.EMPTY_SET,
                                   Collections.EMPTY_SET);
            } else {
                throw new SecurityException("Login failed. Invalid username or password.");
            }
View Full Code Here

            sharedState.put(USERNAME_KEY, username);
            sharedState.put(PASSWORD_KEY, password);
        }

        // Create a new user principal
        user = new JMXPrincipal(username);

        if (logger.debugOn()) {
            logger.debug("login",
                "User '" + username + "' successfully validated");
        }
View Full Code Here

      sharedState.put(USERNAME_KEY, username);
      sharedState.put(PASSWORD_KEY, password);
  }

  // Create a new user principal
  user = new JMXPrincipal(username);

  if (logger.debugOn()) {
      logger.debug("login",
    "User '" + username + "' successfully validated");
  }
View Full Code Here

        {
            throw new SecurityException("Invalid password");
        }

        Set<Principal> principals = new HashSet<Principal>();
        principals.add(new JMXPrincipal(username));
        return new Subject(true, principals, Collections.EMPTY_SET, Collections.EMPTY_SET);
    }
View Full Code Here

        assertEquals(1, principals.size());

        Object ref = principals.iterator().next();
        assertTrue(ref instanceof JMXPrincipal);

        JMXPrincipal jmxPrincipal = (JMXPrincipal) ref;
        String name = jmxPrincipal.getName();
        assertNotNull(name);
        assertEquals(VALID_AUTH_TOKEN[0], name);
    }
View Full Code Here

     * Tests a successful authentication.  Ensures that a populated read-only subject it returned.
     */
    public void testAuthenticationSuccess()
    {
        final Subject expectedSubject = new Subject(true,
                Collections.singleton(new JMXPrincipal(USERNAME)),
                Collections.EMPTY_SET,
                Collections.EMPTY_SET);

        _rmipa.setAuthenticationManager(createTestAuthenticationManager(true, null));

View Full Code Here

    /**
     * Tests appearance of principal name in log message
     */
    public void testSubjectPrincipalNameAppearance()
    {
        Subject subject = new Subject(true, Collections.singleton(new JMXPrincipal("guest")), Collections.EMPTY_SET,
                Collections.EMPTY_SET);

        final String message = Subject.doAs(subject, new PrivilegedAction<String>()
        {
            public String run()
View Full Code Here

      {
         public Subject authenticate(Object credentials) throws SecurityException
         {
            if (password.equals(credentials))
            {
               JMXPrincipal principal = new JMXPrincipal("mx4j");
               Subject subject = new Subject();
               subject.getPrincipals().add(principal);
               subject.setReadOnly();
               return subject;
            }
View Full Code Here

TOP

Related Classes of javax.management.remote.JMXPrincipal

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.