use of org.neo4j.ogm.domain.gh777.UserInfo in project archiva-redback-core by apache.
the class UserServiceTest method getUsers.
@Test
public void getUsers() throws Exception {
String adminHeader = getAdminAuthzHeader();
UserService userService = getUserService(adminHeader);
PagedResult<UserInfo> users = userService.getUsers("", 0, Integer.MAX_VALUE, Collections.emptyList(), "asc");
assertNotNull(users);
assertFalse(users.getData().isEmpty());
}
use of org.neo4j.ogm.domain.gh777.UserInfo in project archiva-redback-core by apache.
the class UserServiceTest method registerNoUrl.
@Test
public void registerNoUrl() throws Exception {
try {
ServicesAssert assertService = JAXRSClientFactory.create("http://localhost:" + getServerPort() + "/" + getRestServicesPath() + "/testsService/", ServicesAssert.class, Collections.singletonList(getJsonProvider()));
assertService.clearEmailMessages();
UserService service = getUserService(getAdminAuthzHeader());
User u = new User();
u.setFullName("the toto");
u.setUserId("toto");
u.setEmail("toto@toto.fr");
u.setPassword("toto123");
u.setConfirmPassword("toto123");
String key = service.registerUser(u.getUserId(), new UserRegistrationRequest(u, null)).getKey();
assertNotEquals("-1", key);
List<EmailMessage> emailMessages = assertService.getEmailMessageSended();
assertEquals(1, emailMessages.size());
assertEquals("toto@toto.fr", emailMessages.get(0).getTos().get(0));
assertEquals("Welcome", emailMessages.get(0).getSubject());
String messageContent = emailMessages.get(0).getText();
log.info("messageContent: {}", messageContent);
assertNotNull(messageContent);
assertTrue(messageContent.contains("Use the following URL to validate your account."));
assertTrue(messageContent.contains("http://localhost:" + getServerPort()));
assertTrue(messageContent.toLowerCase().contains("toto"));
// assertTrue( service.validateUserFromKey( key ).isSuccess( ) );
service = getUserService(getAdminAuthzHeader());
UserInfo uInfo = service.getUser("toto");
assertNotNull(uInfo);
assertFalse(uInfo.isValidated());
assertTrue(uInfo.isPasswordChangeRequired());
// assertTrue( service.validateUserFromKey( key ).isSuccess( ) );
} catch (Exception e) {
log.error(e.getMessage(), e);
throw e;
} finally {
deleteUserQuietly("toto");
}
}
use of org.neo4j.ogm.domain.gh777.UserInfo in project OA4MP by ncsa.
the class LDAPClaimsSource method main.
public static void main(String[] args) {
try {
String rawLdap = "{\"ldap\":{\"failOnError\":\"false\"," + "\"address\":\"ldap.ncsa.illinois.edu\"," + "\"port\":636," + "\"enabled\":\"true\"," + "\"authorizationType\":\"none\"," + "\"searchName\":\"eppn\"," + "\"searchAttributes\":[{" + "\"name\":\"mail\"," + "\"returnAsList\":false," + "\"returnName\":\"mail\"}," + "{\"name\":\"cn\"," + "\"returnAsList\":false," + "\"returnName\":\"name\"}," + "{\"name\":\"memberOf\"," + "\"returnAsList\":false," + "\"isGroup\":true," + "\"returnName\":\"isMemberOf\"}]," + "\"searchBase\":\"ou=People,dc=ncsa,dc=illinois,dc=edu\"," + "\"contextName\":\"\"," + "\"ssl\":{\"tlsVersion\":\"TLS\",\"useJavaTrustStore\":true}}}";
String rawLdap2 = "{\"ldap\": {\n" + " \"address\": \"registry-test.cilogon.org\",\n" + " \"port\": 636,\n" + " \"enabled\": true,\n" + " \"authorizationType\": \"simple\",\n" + " \"failOnError\": false,\n" + " \"notifyOnFail\": false,\n" + " \"password\": \"Eavjofoop4gikpecUzbooljorUryikwu\",\n" + " \"principal\": \"uid=oa4mp_user,ou=system,o=ImPACT,dc=cilogon,dc=org\",\n" + " \"searchAttributes\": [\n" + " {\n" + " \"name\": \"isMemberOf\",\n" + " \"returnAsList\": true,\n" + " \"returnName\": \"isMemberOf\"\n" + " },\n" + " {\n" + " \"name\": \"employeeNumber\",\n" + " \"returnAsList\": false,\n" + " \"returnName\": \"employeeNumber\"\n" + " }\n" + " ],\n" + " \"searchBase\": \"ou=people,o=ImPACT,dc=cilogon,dc=org\",\n" + " \"searchName\": \"username\",\n" + " \"contextName\": \"\",\n" + " \"ssl\": {\n" + " \"keystore\": {},\n" + " \"useJavaTrustStore\": true,\n" + " \"password\": \"changeit\",\n" + " \"type\": \"jks\"\n" + " }\n" + "}}";
DebugUtil.setIsEnabled(true);
ServiceTransaction st = new ServiceTransaction(BasicIdentifier.newID("foo"));
st.setUsername("jbasney@ncsa.illinois.edu");
JSONObject json = JSONObject.fromObject(rawLdap);
LDAPConfiguration cfg = LDAPConfigurationUtil.fromJSON(json);
LDAPClaimsSource claimsSource = new LDAPClaimsSource(cfg, null);
UserInfo ui = new UserInfo();
ui.getMap().put("username", "jbasney@ncsa.illinois.edu");
ui.getMap().put("eppn", "jbasney@ncsa.illinois.edu");
UserInfo ui2 = claimsSource.process(ui, st);
System.out.println("Result of LDAP query:");
System.out.println(ui2.getMap());
// getGid(cfg, "lsst_users");
} catch (Throwable t) {
t.printStackTrace();
}
}
use of org.neo4j.ogm.domain.gh777.UserInfo in project OA4MP by ncsa.
the class OA2TestCommands method getuserinfo.
public void getuserinfo(InputLine inputLine) throws Exception {
if (showHelp(inputLine)) {
getUIHelp();
return;
}
UserInfo userInfo = getOA2S().getUserInfo(dummyAsset.getIdentifier().toString());
say("user info:");
for (String key : userInfo.getMap().keySet()) {
say(" " + key + " = " + userInfo.getMap().get(key));
}
}
use of org.neo4j.ogm.domain.gh777.UserInfo in project OA4MP by ncsa.
the class OA2MPService method getUserInfo.
public UserInfo getUserInfo(String identifier) {
OA2Asset asset = getAsset2(identifier);
if (asset == null || asset.getAccessToken() == null)
return null;
UIRequest uiRequest = new UIRequest(asset.getAccessToken());
uiRequest.setClient(getEnvironment().getClient());
DS2 ds2 = (DS2) getEnvironment().getDelegationService();
UIResponse resp = ds2.getUserInfo(uiRequest);
JSONObject json = JSONObject.fromObject(resp.getRawJSON());
UserInfo ui = new UserInfo();
// return everything, even specialized fields.
ui.setMap(json);
// UserInfo ui = (UserInfo) JSONObject.toBean(json, UserInfo.class);
return ui;
}
Aggregations