use of alluxio.security.User in project alluxio by Alluxio.
the class GrpcSecurityTest method createSubject.
private Subject createSubject(String username, String password) {
Subject subject = new Subject();
subject.getPrincipals().add(new User(username));
subject.getPrivateCredentials().add(password);
return subject;
}
use of alluxio.security.User in project alluxio by Alluxio.
the class UserStateTest method securityEnabled.
// TODO(dong): getKerberosLoginUserTest()
@Test
public void securityEnabled() throws Exception {
mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.NOSASL.getAuthName());
// without security, the user will be blank.
User u = UserState.Factory.create(mConfiguration).getUser();
Assert.assertEquals("", u.getName());
}
use of alluxio.security.User in project alluxio by Alluxio.
the class UserStateTest method getCustomLoginUserWhenNotProvidedByApp.
/**
* Tests whether we can get login user with conf in CUSTOM mode, when user name is set to an
* empty string in the application configuration. In this case, login should return the OS user
* instead of empty string.
*/
@Test
public void getCustomLoginUserWhenNotProvidedByApp() throws Exception {
mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.CUSTOM.getAuthName());
mConfiguration.unset(PropertyKey.SECURITY_LOGIN_USERNAME);
UserState s = UserState.Factory.create(mConfiguration);
User loginUser = s.getUser();
assertNotNull(loginUser);
assertEquals(System.getProperty("user.name"), loginUser.getName());
}
use of alluxio.security.User in project alluxio by Alluxio.
the class UserStateTest method getSimpleLoginUserWhenNotProvidedByApp.
/**
* Tests whether we can get login user with conf in SIMPLE mode, when user name is set to an
* empty string in the application configuration. In this case, login should return the OS user
* instead of empty string.
*/
@Test
public void getSimpleLoginUserWhenNotProvidedByApp() throws Exception {
mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE.getAuthName());
mConfiguration.unset(PropertyKey.SECURITY_LOGIN_USERNAME);
UserState s = UserState.Factory.create(mConfiguration);
User loginUser = s.getUser();
assertNotNull(loginUser);
assertEquals(System.getProperty("user.name"), loginUser.getName());
}
use of alluxio.security.User in project alluxio by Alluxio.
the class UserStateTest method getSimpleLoginUserProvidedByApp.
/**
* Tests whether we can get login user with conf in SIMPLE mode, when user name is provided by
* the application through configuration.
*/
@Test
public void getSimpleLoginUserProvidedByApp() throws Exception {
mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE.getAuthName());
mConfiguration.set(PropertyKey.SECURITY_LOGIN_USERNAME, "alluxio-user");
UserState s = UserState.Factory.create(mConfiguration);
User loginUser = s.getUser();
assertNotNull(loginUser);
assertEquals("alluxio-user", loginUser.getName());
}
Aggregations