Package javax.management.remote

Examples of javax.management.remote.JMXPrincipal


      }

      String user, pass;
      user = pair[0];
      pass = pair[1];
      Principal principal = new JMXPrincipal(user);
      Subject subject = new Subject();

      securityContext = SecurityFactory.establishSecurityContext(securityDomainName);
      am = securityContext.getAuthenticationManager();
View Full Code Here


                throw new SecurityException("Unknown user " + user);
              if (!myPassword.equals(password))
                throw new SecurityException("Bad password");

              Set principals = new HashSet();
              principals.add(new JMXPrincipal(user));
              return new Subject(true, principals, Collections.EMPTY_SET, Collections.EMPTY_SET);
            }

          };
          environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
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

                long sid = sessionId.incrementAndGet();
                principal = new JGDIPrincipal(trustedName, sid);
                subject.getPrincipals().add(principal);
                log.log(Level.FINE, "{0} added to subject", principal);
                if (jmxPrincipalName != null) {
                    jmxPrincipal = new JMXPrincipal(jmxPrincipalName);
                    subject.getPrincipals().add(jmxPrincipal);
                    log.log(Level.FINE, "{0} added to subject", jmxPrincipal);
                }
                commitSucceded = true;
            } else {
View Full Code Here

            throw new SecurityException("Authentication manager failed", result.getCause());
        }
        else if (AuthenticationStatus.SUCCESS.equals(result.getStatus()))
        {
            final Subject subject = result.getSubject();
            subject.getPrincipals().add(new JMXPrincipal(username));
            subject.setReadOnly();
            return subject;
        }
        else
        {
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

      String storedPassword = (String)passwords.get(user);
      if (!isPasswordCorrect(password, storedPassword)) throw new SecurityException("Bad password");

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

      // Connect to the server
      JMXConnector cntor = JMXConnectorFactory.connect(url, environment);

      // Create a subject to delegate to
      JMXPrincipal principal = new JMXPrincipal("anotherGuest");
      Set principals = new HashSet();
      principals.add(principal);
      Subject delegate = new Subject(true, principals, Collections.EMPTY_SET, Collections.EMPTY_SET);

      // Get two MBeanServerConnection: one that uses the 'guest' principal directly,
View Full Code Here

/**
* @version $Revision: 467084 $
*/
public class SslSocketHelper {
    public static SSLSocket createSSLSocket(String certDistinguishedName, boolean wantAuth, boolean needAuth) throws IOException {
        JMXPrincipal principal = new JMXPrincipal(certDistinguishedName);
        X509Certificate cert = new StubX509Certificate(principal);
        StubSSLSession sslSession = new StubSSLSession(cert);

        StubSSLSocket sslSocket = new StubSSLSocket(sslSession);
        sslSocket.setWantClientAuth(wantAuth);
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.