Search in sources :

Example 1 with StandardNiFiUser

use of org.apache.nifi.authorization.user.StandardNiFiUser in project nifi by apache.

the class X509AuthenticationProviderTest method testShouldCreateAnonymousUser.

@Test
public void testShouldCreateAnonymousUser() {
    // Arrange
    String identity = "someone";
    // Act
    NiFiUser user = X509AuthenticationProvider.createUser(identity, null, null, null, true);
    // Assert
    assert user != null;
    assert user instanceof StandardNiFiUser;
    assert user.getIdentity().equals(StandardNiFiUser.ANONYMOUS_IDENTITY);
    assert user.isAnonymous();
}
Also used : StandardNiFiUser(org.apache.nifi.authorization.user.StandardNiFiUser) StandardNiFiUser(org.apache.nifi.authorization.user.StandardNiFiUser) NiFiUser(org.apache.nifi.authorization.user.NiFiUser) Test(org.junit.Test)

Example 2 with StandardNiFiUser

use of org.apache.nifi.authorization.user.StandardNiFiUser in project nifi by apache.

the class X509AuthenticationProviderTest method testShouldCreateKnownUser.

@Test
public void testShouldCreateKnownUser() {
    // Arrange
    String identity = "someone";
    // Act
    NiFiUser user = X509AuthenticationProvider.createUser(identity, null, null, null, false);
    // Assert
    assert user != null;
    assert user instanceof StandardNiFiUser;
    assert user.getIdentity().equals(identity);
    assert !user.isAnonymous();
}
Also used : StandardNiFiUser(org.apache.nifi.authorization.user.StandardNiFiUser) StandardNiFiUser(org.apache.nifi.authorization.user.StandardNiFiUser) NiFiUser(org.apache.nifi.authorization.user.NiFiUser) Test(org.junit.Test)

Aggregations

NiFiUser (org.apache.nifi.authorization.user.NiFiUser)2 StandardNiFiUser (org.apache.nifi.authorization.user.StandardNiFiUser)2 Test (org.junit.Test)2