Search in sources :

Example 1 with UserInfo

use of org.neo4j.ogm.domain.gh777.UserInfo in project OA4MP by ncsa.

the class LDAPSSLSocketFactory method main.

public static void main(String[] args) {
    try {
        DebugUtil.dbg(LDAPSSLSocketFactory.class, System.getProperty("java.home") + "/lib/security/cacerts");
        DebugUtil.setIsEnabled(true);
        // System.setProperty("javax.net.debug", "ssl");
        JSONObject json = JSONObject.fromObject(ldap);
        LDAPConfiguration ldapConfiguration = LDAPConfigurationUtil.fromJSON(json);
        setLdapConfiguration(ldapConfiguration);
        ldapConfiguration.setContextName("");
        getSslConfiguration().setTlsVersion(SSLConfigurationUtil.TLS_1_2);
        getSslConfiguration().setUseDefaultJavaTrustStore(false);
        getSslConfiguration().setKeystoreType("JKS");
        getSslConfiguration().setKeystorePassword("changeit");
        getSslConfiguration().setKeystore("/home/ncsa/temp/java-certs/cacerts2");
        getSslConfiguration().setTrustRootType("JKS");
        getSslConfiguration().setTrustRootPassword("changeit");
        getSslConfiguration().setTrustRootPath("/home/ncsa/temp/java-certs/cacerts2");
        LDAPClaimsSource x = new LDAPClaimsSource(ldapConfiguration, null);
        LDAPSSLSocketFactory.setLdapConfiguration(ldapConfiguration);
        x.createConnection();
        UserInfo userInfo = new UserInfo();
        userInfo.getMap().putAll(x.simpleSearch(x.context, "http://cilogon.org/serverA/users/10376", ldapConfiguration.getSearchAttributes()));
        System.out.println(userInfo);
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
Also used : JSONObject(net.sf.json.JSONObject) UserInfo(edu.uiuc.ncsa.security.oauth_2_0.UserInfo) LDAPConfiguration(edu.uiuc.ncsa.security.oauth_2_0.server.config.LDAPConfiguration)

Example 2 with UserInfo

use of org.neo4j.ogm.domain.gh777.UserInfo in project OA4MP by ncsa.

the class OA2CLCCommands method get_user_info.

public void get_user_info(InputLine inputLine) throws Exception {
    if (showHelp(inputLine)) {
        getUIHelp();
        return;
    }
    UserInfo userInfo = getService().getUserInfo(dummyAsset.getIdentifier().toString());
    say("user info:");
    for (String key : userInfo.getMap().keySet()) {
        say("          " + key + " = " + userInfo.getMap().get(key));
    }
}
Also used : UserInfo(edu.uiuc.ncsa.security.oauth_2_0.UserInfo)

Example 3 with UserInfo

use of org.neo4j.ogm.domain.gh777.UserInfo in project neo4j-ogm by neo4j.

the class SingleUseEntityMapperTest method oneTimeSetUp.

@BeforeClass
public static void oneTimeSetUp() {
    sessionFactory = new SessionFactory(getDriver(), "org.neo4j.ogm.domain.gh551", "org.neo4j.ogm.domain.gh391", "org.neo4j.ogm.domain.gh750", "org.neo4j.ogm.domain.gh777", "org.neo4j.ogm.domain.cineasts.minimum", "org.neo4j.ogm.domain.gh813", "org.neo4j.ogm.domain.gh873");
    // Prepare test data
    Session session = sessionFactory.openSession();
    session.query("MATCH (n) DETACH DELETE n", EMPTY_MAP);
    session.query("unwind range(1,10) as x with x create (n:ThingEntity {name: 'Thing ' + x}) return n", EMPTY_MAP);
    Actor actor = new Actor("A1");
    Movie movie = new Movie("M1");
    Role role = new Role("R1", actor, movie);
    session.save(role);
    movie = new Movie("M2");
    role = new Role("R2", actor, movie);
    session.save(role);
    session.save(new UserInfo("Foo", "Bar", "i@do.com"));
    MyNode myNode = new MyNode();
    myNode.setId("the-id");
    myNode.setType("the-type");
    myNode.getAttributes().put("a1", "v1");
    myNode.getAttributes().put("a2", "v2");
    session.save(myNode);
}
Also used : SessionFactory(org.neo4j.ogm.session.SessionFactory) Role(org.neo4j.ogm.domain.cineasts.minimum.Role) Movie(org.neo4j.ogm.domain.cineasts.minimum.Movie) Actor(org.neo4j.ogm.domain.cineasts.minimum.Actor) UserInfo(org.neo4j.ogm.domain.gh777.UserInfo) MyNode(org.neo4j.ogm.domain.gh873.MyNode) Session(org.neo4j.ogm.session.Session) BeforeClass(org.junit.BeforeClass)

Example 4 with UserInfo

use of org.neo4j.ogm.domain.gh777.UserInfo in project archiva-redback-core by apache.

the class NativeRoleServiceTest method getAssignedUsersNonRecursive.

@Test
void getAssignedUsersNonRecursive() {
    String token = getAdminToken();
    Map<String, Object> jsonAsMap = new HashMap<>();
    jsonAsMap.put("user_id", "aragorn");
    jsonAsMap.put("email", "aragorn@lordoftherings.org");
    jsonAsMap.put("full_name", "Aragorn King of Gondor ");
    jsonAsMap.put("password", "pAssw0rD");
    try {
        given().spec(getRequestSpec(token, getUserServicePath())).contentType(JSON).body(jsonAsMap).when().post().then().statusCode(201);
        given().spec(getRequestSpec(token)).contentType(JSON).when().put("archiva-global-repository-observer/user/aragorn").then().statusCode(200);
        Response result = given().spec(getRequestSpec(token)).contentType(JSON).when().get("archiva-global-repository-observer/user").then().statusCode(200).extract().response();
        assertNotNull(result);
        PagedResult<UserInfo> userResult = result.getBody().jsonPath().getObject("", PagedResult.class);
        assertNotNull(userResult);
        assertEquals(1, userResult.getPagination().getTotalCount());
        List<UserInfo> users = result.getBody().jsonPath().getList("data", UserInfo.class);
        assertArrayEquals(new String[] { "aragorn" }, users.stream().map(BaseUserInfo::getUserId).sorted().toArray(String[]::new));
    } finally {
        given().spec(getRequestSpec(token, getUserServicePath())).contentType(JSON).when().delete("aragorn").then().statusCode(200);
    }
}
Also used : Response(io.restassured.response.Response) HashMap(java.util.HashMap) UserInfo(org.apache.archiva.redback.rest.api.model.v2.UserInfo) BaseUserInfo(org.apache.archiva.redback.rest.api.model.v2.BaseUserInfo) Test(org.junit.jupiter.api.Test)

Example 5 with UserInfo

use of org.neo4j.ogm.domain.gh777.UserInfo in project archiva-redback-core by apache.

the class NativeRoleServiceTest method updateRole.

@Test
void updateRole() {
    String token = getAdminToken();
    try {
        Response response = given().spec(getRequestSpec(token)).contentType(JSON).when().put("templates/archiva-repository-manager/repository13").then().statusCode(201).extract().response();
        assertNotNull(response);
        RoleInfo roleInfo = response.getBody().jsonPath().getObject("", RoleInfo.class);
        Map<String, Object> jsonAsMap = new HashMap<>();
        jsonAsMap.put("id", roleInfo.getId());
        jsonAsMap.put("name", roleInfo.getName());
        jsonAsMap.put("description", "This description was updated.");
        response = given().spec(getRequestSpec(token)).contentType(JSON).when().body(jsonAsMap).patch(roleInfo.getId()).then().statusCode(200).extract().response();
        assertNotNull(response);
        RoleInfo updatedRole = response.getBody().jsonPath().getObject("", RoleInfo.class);
        assertEquals(roleInfo.getId(), updatedRole.getId());
        assertEquals(roleInfo.getName(), updatedRole.getName());
        assertEquals("This description was updated.", updatedRole.getDescription());
        assertEquals(true, updatedRole.isAssignable());
        assertEquals(false, updatedRole.isPermanent());
        response = given().spec(getRequestSpec(token)).contentType(JSON).when().get("archiva-repository-manager.repository13/user").then().extract().response();
        List<UserInfo> userList = response.getBody().jsonPath().getList("data", UserInfo.class);
        assertEquals(0, userList.size());
    } finally {
        given().spec(getRequestSpec(token)).contentType(JSON).when().delete("templates/archiva-repository-manager/repository13").then().statusCode(200);
        given().spec(getRequestSpec(token)).contentType(JSON).when().delete("templates/archiva-repository-observer/repository13").then().statusCode(200);
    }
}
Also used : Response(io.restassured.response.Response) RoleInfo(org.apache.archiva.redback.rest.api.model.v2.RoleInfo) HashMap(java.util.HashMap) UserInfo(org.apache.archiva.redback.rest.api.model.v2.UserInfo) BaseUserInfo(org.apache.archiva.redback.rest.api.model.v2.BaseUserInfo) Test(org.junit.jupiter.api.Test)

Aggregations

UserInfo (org.apache.archiva.redback.rest.api.model.v2.UserInfo)19 Test (org.junit.jupiter.api.Test)15 Response (io.restassured.response.Response)8 HashMap (java.util.HashMap)8 UserInfo (edu.uiuc.ncsa.security.oauth_2_0.UserInfo)7 BaseUserInfo (org.apache.archiva.redback.rest.api.model.v2.BaseUserInfo)7 UserService (org.apache.archiva.redback.rest.api.services.v2.UserService)6 NotFoundException (javax.ws.rs.NotFoundException)5 User (org.apache.archiva.redback.rest.api.model.v2.User)5 ForbiddenException (javax.ws.rs.ForbiddenException)4 JSONObject (net.sf.json.JSONObject)4 RoleInfo (org.apache.archiva.redback.rest.api.model.v2.RoleInfo)4 List (java.util.List)3 Map (java.util.Map)3 PagedResult (org.apache.archiva.components.rest.model.PagedResult)3 RoleTemplate (org.apache.archiva.redback.rest.api.model.v2.RoleTemplate)3 UserRegistrationRequest (org.apache.archiva.redback.rest.api.model.v2.UserRegistrationRequest)3 RedbackServiceException (org.apache.archiva.redback.rest.api.services.RedbackServiceException)3 EmailMessage (org.apache.archiva.redback.rest.services.mock.EmailMessage)3 ServicesAssert (org.apache.archiva.redback.rest.services.mock.ServicesAssert)3