Search in sources :

Example 11 with LDAPConfiguration

use of edu.uiuc.ncsa.security.oauth_2_0.server.config.LDAPConfiguration in project OA4MP by ncsa.

the class DDServerTests method getOa2Client.

protected OA2Client getOa2Client(ClientStore store) {
    OA2Client c = (OA2Client) store.create();
    String random = getRandom(8);
    c.setSecret(getRandom(64));
    c.setProxyLimited(true);
    c.setHomeUri("https://baz.foo.edu/" + random + "/home");
    c.setErrorUri("https://baz.foo.edu/home/" + random + "/error");
    c.setProxyLimited(false);
    c.setEmail("bob@" + random + ".foo.bar");
    c.setName("Test client " + random);
    c.setRtLifetime(456767875477L);
    LinkedList<String> callbacks = new LinkedList<>();
    callbacks.add("https:/baz.foo.edu/client2/" + random + "/ready1");
    callbacks.add("https:/baz.foo.edu/client2/" + random + "/ready2");
    c.setCallbackURIs(callbacks);
    LDAPConfiguration ldapConfiguration = new LDAPConfiguration();
    ldapConfiguration.setServer("foo.bar.edu");
    LinkedList<LDAPConfiguration> ldaps = new LinkedList<>();
    ldaps.add(ldapConfiguration);
    c.setLdaps(ldaps);
    LinkedList<String> scopes = new LinkedList<>();
    scopes.add(OA2Scopes.SCOPE_OPENID);
    scopes.add(OA2Scopes.SCOPE_EMAIL);
    scopes.add(OA2Scopes.SCOPE_PROFILE);
    scopes.add(OA2Scopes.SCOPE_CILOGON_INFO);
    c.setScopes(scopes);
    store.save(c);
    return c;
}
Also used : LDAPConfiguration(edu.uiuc.ncsa.security.oauth_2_0.server.config.LDAPConfiguration) LinkedList(java.util.LinkedList)

Aggregations

LDAPConfiguration (edu.uiuc.ncsa.security.oauth_2_0.server.config.LDAPConfiguration)11 JSONObject (net.sf.json.JSONObject)4 OA2Client (edu.uiuc.ncsa.security.oauth_2_0.OA2Client)3 LinkedList (java.util.LinkedList)3 LDAPEntry (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.cm.ldap.LDAPEntry)2 UserInfo (edu.uiuc.ncsa.security.oauth_2_0.UserInfo)2 Test (org.junit.Test)2 ServiceTransaction (edu.uiuc.ncsa.security.delegation.server.ServiceTransaction)1 ClientApproval (edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval)1 ClaimSource (edu.uiuc.ncsa.security.oauth_2_0.server.ClaimSource)1 LDAPConfigurationUtil (edu.uiuc.ncsa.security.oauth_2_0.server.config.LDAPConfigurationUtil)1 SSLConfiguration (edu.uiuc.ncsa.security.util.ssl.SSLConfiguration)1 BufferedReader (java.io.BufferedReader)1 StringReader (java.io.StringReader)1 NamingEnumeration (javax.naming.NamingEnumeration)1 LdapContext (javax.naming.ldap.LdapContext)1 JSON (net.sf.json.JSON)1