use of org.ow2.proactive.authentication.UserData in project scheduling by ow2-proactive.
the class AuthenticationTest method loginAsUser.
private void loginAsUser(SchedulerAuthenticationInterface auth, PublicKey pubKey) throws KeyException, LoginException, AlreadyConnectedException, NotConnectedException, PermissionException {
log("Test 2");
log("Trying to authorized as a user with correct user name and password");
Credentials cred = Credentials.createCredentials(new CredData(TestUsers.USER.username, TestUsers.USER.password), pubKey);
Scheduler user = auth.login(cred);
String userName = user.getCurrentUser();
Assert.assertEquals(TestUsers.USER.username, userName);
UserData userData = user.getCurrentUserData();
Assert.assertNotNull(userData);
Assert.assertNotNull(userData.getUserName());
Assert.assertNotNull(userData.getGroups());
Assert.assertTrue(userData.getGroups().contains("user"));
user.disconnect();
log("Passed: successful authentication");
}
Aggregations