public boolean isPhone_number_verified() { return getBoolean(PHONE_NUMBER_VERIFIED); }
public int getUpdated_at() {return getInt(UPDATED_AT);} public void setUpdated_at(int updated_at) {put(UPDATED_AT,updated_at);}
public JSONObject getAddress() { return getJSON(ADDRESS); }
public boolean getBoolean(String key) { Object x = getMap().get(key); if (x instanceof Boolean) return (Boolean) x; return false; }
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); LDAPConfigurationUtil ldapConfigurationUtil = new LDAPConfigurationUtil(); 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(); } }
/** * @param request User info request * @return User info response */ public UIIResponse2 processUIRequest(UIIRequest2 request) { Map<String, String> reqParamMap = OA2Utilities.getParameters(request.getServletRequest()); UIIResponse2 uiiResponse2 = new UIIResponse2(); uiiResponse2.setParameters(reqParamMap); uiiResponse2.setAccessToken(request.getAccessToken()); UserInfo userInfo = new UserInfo(); userInfo.setSub(request.getUsername()); uiiResponse2.setUserInfo(userInfo); return uiiResponse2; }
public void setFamily_name(String family_name) { put(FAMILY_NAME, family_name); }
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(); ui.setMap(json); // return everything, even specialized fields. //UserInfo ui = (UserInfo) JSONObject.toBean(json, UserInfo.class); return ui; }
public String getNickname() { return getString(NICKNAME); }
public JSONObject getJSON(String key){ return (JSONObject)getMap().get(key); } public void put(String key, String value) {
public void setLocale(String locale) { put(LOCALE, locale); }
public String getPicture() { return getString(PICTURE); }
public int getInt(String key) { Object x = getMap().get(key); if (x instanceof Integer) return (Integer) x; return 0; }
public void setPhone_number(String phone_number) { put(PHONE_NUMBER, phone_number); }
public String getZoneinfo() { return getString(ZONEINFO); }
public boolean isEmail_verified() { return getBoolean(EMAIL_VERIFIED); }
public void put(String key, Integer x){ getMap().put(key,x); } public void put(String key, JSONObject json){
public void setEmail_verified(boolean email_verified) { put(EMAIL_VERIFIED, email_verified); } public String getGender() {
public String getPreferred_username() { return getString(PREFERRED_USERNAME); }
public void put(String key, JSONObject json){ getMap().put(key,json); } public UserInfo() {