java类javax.management.remote.JMXPrincipal的实例源码

NotificationAccessControllerTest.java 文件源码 项目:openjdk-source-code-learn 阅读 22 收藏 0 点赞 0 评论 0
public void fetchNotification(
    String connectionId,
    ObjectName name,
    Notification notification,
    Subject subject)
    throws SecurityException {
    echo("fetchNotification:");
    echo("\tconnectionId: " +  connectionId);
    echo("\tname: " +  name);
    echo("\tnotification: " +  notification);
    echo("\tsubject: " +
         (subject == null ? null : subject.getPrincipals()));
    if (!throwException)
        if (name.getCanonicalName().equals("domain:name=2,type=NB") &&
            subject.getPrincipals().contains(new JMXPrincipal("role")))
            throw new SecurityException();
}
NotificationAccessControllerTest.java 文件源码 项目:OLD-OpenJDK8 阅读 23 收藏 0 点赞 0 评论 0
public void addNotificationListener(
    String connectionId,
    ObjectName name,
    Subject subject)
    throws SecurityException {
    echo("addNotificationListener:");
    echo("\tconnectionId: " +  connectionId);
    echo("\tname: " +  name);
    echo("\tsubject: " +
         (subject == null ? null : subject.getPrincipals()));
    if (throwException)
        if (name.getCanonicalName().equals("domain:name=1,type=NB")
            &&
            subject.getPrincipals().contains(new JMXPrincipal("role")))
            throw new SecurityException();
}
NotificationAccessControllerTest.java 文件源码 项目:OLD-OpenJDK8 阅读 23 收藏 0 点赞 0 评论 0
public void removeNotificationListener(
    String connectionId,
    ObjectName name,
    Subject subject)
    throws SecurityException {
    echo("removeNotificationListener:");
    echo("\tconnectionId: " +  connectionId);
    echo("\tname: " +  name);
    echo("\tsubject: " +
         (subject == null ? null : subject.getPrincipals()));
    if (throwException)
        if (name.getCanonicalName().equals("domain:name=2,type=NB")
            &&
            subject.getPrincipals().contains(new JMXPrincipal("role")))
            throw new SecurityException();
}
NotificationAccessControllerTest.java 文件源码 项目:OLD-OpenJDK8 阅读 19 收藏 0 点赞 0 评论 0
public void fetchNotification(
    String connectionId,
    ObjectName name,
    Notification notification,
    Subject subject)
    throws SecurityException {
    echo("fetchNotification:");
    echo("\tconnectionId: " +  connectionId);
    echo("\tname: " +  name);
    echo("\tnotification: " +  notification);
    echo("\tsubject: " +
         (subject == null ? null : subject.getPrincipals()));
    if (!throwException)
        if (name.getCanonicalName().equals("domain:name=2,type=NB") &&
            subject.getPrincipals().contains(new JMXPrincipal("role")))
            throw new SecurityException();
}
OVXLoginService.java 文件源码 项目:CoVisor 阅读 21 收藏 0 点赞 0 评论 0
@Override
public UserIdentity getUserIdentity() {
    // TODO: need to return the correct identity for this user.
    // Permitting specific logins for now with no passwords
    if (this.user.equals("tenant")) {
        return new DefaultUserIdentity(new Subject(), new JMXPrincipal(
                this.user), new String[] {"user"});
    } else if (this.user.equals("ui")) {
        return new DefaultUserIdentity(new Subject(), new JMXPrincipal(
                this.user), new String[] {"ui"});
    } else if (this.user.equals("admin")) {
        return new DefaultUserIdentity(new Subject(), new JMXPrincipal(
                this.user), new String[] {"user", "admin", "ui"});
    } else {
        return null;
    }

}
NotificationAccessControllerTest.java 文件源码 项目:JAVA_UNIT 阅读 19 收藏 0 点赞 0 评论 0
public void addNotificationListener(
    String connectionId,
    ObjectName name,
    Subject subject)
    throws SecurityException {
    echo("addNotificationListener:");
    echo("\tconnectionId: " +  connectionId);
    echo("\tname: " +  name);
    echo("\tsubject: " +
         (subject == null ? null : subject.getPrincipals()));
    if (throwException)
        if (name.getCanonicalName().equals("domain:name=1,type=NB")
            &&
            subject.getPrincipals().contains(new JMXPrincipal("role")))
            throw new SecurityException();
}
NotificationAccessControllerTest.java 文件源码 项目:JAVA_UNIT 阅读 21 收藏 0 点赞 0 评论 0
public void removeNotificationListener(
    String connectionId,
    ObjectName name,
    Subject subject)
    throws SecurityException {
    echo("removeNotificationListener:");
    echo("\tconnectionId: " +  connectionId);
    echo("\tname: " +  name);
    echo("\tsubject: " +
         (subject == null ? null : subject.getPrincipals()));
    if (throwException)
        if (name.getCanonicalName().equals("domain:name=2,type=NB")
            &&
            subject.getPrincipals().contains(new JMXPrincipal("role")))
            throw new SecurityException();
}
NotificationAccessControllerTest.java 文件源码 项目:JAVA_UNIT 阅读 21 收藏 0 点赞 0 评论 0
public void fetchNotification(
    String connectionId,
    ObjectName name,
    Notification notification,
    Subject subject)
    throws SecurityException {
    echo("fetchNotification:");
    echo("\tconnectionId: " +  connectionId);
    echo("\tname: " +  name);
    echo("\tnotification: " +  notification);
    echo("\tsubject: " +
         (subject == null ? null : subject.getPrincipals()));
    if (!throwException)
        if (name.getCanonicalName().equals("domain:name=2,type=NB") &&
            subject.getPrincipals().contains(new JMXPrincipal("role")))
            throw new SecurityException();
}
CarbonJMXAuthenticator.java 文件源码 项目:carbon-kernel 阅读 20 收藏 0 点赞 0 评论 0
@Override
public Subject authenticate(Object credentials) {
    if (credentials == null) {
        throw new SecurityException("Credentials required");
    }

    if (!(credentials instanceof String[])) {
        throw new SecurityException("Credentials should be String[]");
    }

    CallbackHandler callbackHandler = new CarbonJMXCallbackHandler(credentials);
    try {
        LoginContext loginContext = new LoginContext(Constants.LOGIN_MODULE_ENTRY, callbackHandler);
        loginContext.login();
        return new Subject(true, Collections.singleton(new JMXPrincipal(((String[]) credentials)[0])),
                Collections.EMPTY_SET, Collections.EMPTY_SET);
    } catch (LoginException e) {
        throw new SecurityException("Invalid credentials", e);
    }
}
RMIPasswordAuthenticatorTest.java 文件源码 项目:andes 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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));


    Subject newSubject = _rmipa.authenticate(_credentials);
    assertTrue("Subject must be readonly", newSubject.isReadOnly());
    assertTrue("Returned subject does not equal expected value",
            newSubject.equals(expectedSubject));

}


问题


面经


文章

微信
公众号

扫码关注公众号