Skip to content

Commit

Permalink
Sync with SVN
Browse files Browse the repository at this point in the history
  • Loading branch information
yurem committed Jul 9, 2014
1 parent 5fc74dd commit bb73b97
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 107 deletions.
2 changes: 1 addition & 1 deletion oxGwt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.xdi</groupId>
<artifactId>oxCore</artifactId>
<version>1.1.0.Final</version>
<version>1.2.0.Final</version>
</parent>

<prerequisites>
Expand Down
2 changes: 1 addition & 1 deletion oxLdap-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.xdi</groupId>
<artifactId>oxCore</artifactId>
<version>1.1.0.Final</version>
<version>1.2.0.Final</version>
</parent>

<prerequisites>
Expand Down
2 changes: 1 addition & 1 deletion oxLdap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>org.xdi</groupId>
<artifactId>oxCore</artifactId>
<version>1.1.0.Final</version>
<version>1.2.0.Final</version>
</parent>

<prerequisites>
Expand Down
61 changes: 48 additions & 13 deletions oxLdap/src/main/java/org/gluu/site/ldap/LDAPConnectionProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,21 @@ public class LDAPConnectionProvider {

private static final Logger log = Logger.getLogger(LDAPConnectionProvider.class);

public static final String bindPassword = "bindPassword";
private static final int DEFAULT_SUPPORTED_LDAP_VERSION = 2;

private LDAPConnectionPool connectionPool;
private ResultCode creationResultCode;

private int supportedLDAPVersion = DEFAULT_SUPPORTED_LDAP_VERSION;

private String[] servers;
private String[] addresses;
private int[] ports;

private String bindDn;
private String bindPassword;
private boolean useSSL;

@SuppressWarnings("unused")
private LDAPConnectionProvider() {}

Expand All @@ -59,34 +66,38 @@ public LDAPConnectionProvider(Properties props) {
*/
public void init(Properties props) throws NumberFormatException, LDAPException, GeneralSecurityException {
String serverProp = props.getProperty("servers");
String[] servers = serverProp.split(",");
String[] addresses = new String[servers.length];
int[] ports = new int[servers.length];
for (int i = 0; i < servers.length; i++) {
String str = servers[i];
addresses[i] = str.substring(0, str.indexOf(":")).trim();
ports[i] = Integer.parseInt(str.substring(str.indexOf(":") + 1, str.length()));
this.servers = serverProp.split(",");
this.addresses = new String[this.servers.length];
this.ports = new int[this.servers.length];
for (int i = 0; i < this.servers.length; i++) {
String str = this.servers[i];
this.addresses[i] = str.substring(0, str.indexOf(":")).trim();
this.ports[i] = Integer.parseInt(str.substring(str.indexOf(":") + 1, str.length()));
}

BindRequest bindRequest = null;
if (StringHelper.isEmpty(props.getProperty("bindDN"))) {
this.bindDn = null;
this.bindPassword = null;
bindRequest = new SimpleBindRequest();
} else {
bindRequest = new SimpleBindRequest(props.getProperty("bindDN"), props.getProperty(bindPassword));
this.bindDn = props.getProperty("bindDN");
this.bindPassword = props.getProperty("bindPassword");
bindRequest = new SimpleBindRequest(this.bindDn, this.bindPassword);
}

LDAPConnectionOptions connectionOptions = new LDAPConnectionOptions();
connectionOptions.setConnectTimeoutMillis(100 * 1000);
connectionOptions.setAutoReconnect(true);

boolean useSSL = Boolean.valueOf(props.getProperty("useSSL"));
this.useSSL = Boolean.valueOf(props.getProperty("useSSL")).booleanValue();

FailoverServerSet failoverSet;
if (useSSL) {
if (this.useSSL) {
SSLUtil sslUtil = new SSLUtil(new TrustAllTrustManager());
failoverSet = new FailoverServerSet(addresses, ports, sslUtil.createSSLSocketFactory(), connectionOptions);
failoverSet = new FailoverServerSet(this.addresses, this.ports, sslUtil.createSSLSocketFactory(), connectionOptions);
} else {
failoverSet = new FailoverServerSet(addresses, ports, connectionOptions);
failoverSet = new FailoverServerSet(this.addresses, this.ports, connectionOptions);
}

connectionPool = new LDAPConnectionPool(failoverSet, bindRequest, Integer.parseInt(props.getProperty("maxconnections")));
Expand Down Expand Up @@ -212,4 +223,28 @@ public void setCreationResultCode(ResultCode creationResultCode) {
this.creationResultCode = creationResultCode;
}

public String[] getServers() {
return servers;
}

public String[] getAddresses() {
return addresses;
}

public int[] getPorts() {
return ports;
}

public String getBindDn() {
return bindDn;
}

public String getBindPassword() {
return bindPassword;
}

public boolean isUseSSL() {
return useSSL;
}

}
4 changes: 2 additions & 2 deletions oxSaml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<artifactId>oxSaml</artifactId>
<name>oxSaml</name>
<packaging>jar</packaging>
<version>1.1.0.Final</version>
<version>1.2.0.Final</version>

<parent>
<groupId>org.xdi</groupId>
<artifactId>oxCore</artifactId>
<version>1.1.0.Final</version>
<version>1.2.0.Final</version>
</parent>

<prerequisites>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.xdi.saml;
package org.gluu.saml;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.xdi.saml;
package org.gluu.saml;

import java.io.ByteArrayInputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.xdi.saml;
package org.gluu.saml;

import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
Expand Down
2 changes: 1 addition & 1 deletion oxService/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.xdi</groupId>
<artifactId>oxCore</artifactId>
<version>1.1.0.Final</version>
<version>1.2.0.Final</version>
</parent>

<prerequisites>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import java.io.Serializable;

import lombok.Data;

/**
* oxTrust configuration
*
* @author Yuriy Movchan
* @version 0.1, 05/15/2013
*/
public final class ApplicationConfiguration implements Serializable {
public final @Data class ApplicationConfiguration implements Serializable {

private static final long serialVersionUID = -8991383390239617013L;

Expand Down Expand Up @@ -81,16 +83,10 @@ public final class ApplicationConfiguration implements Serializable {
private String idpLdapServer;
private String idpBindDn;
private String idpBindPassword;
private String idpUserFields;

private String gluuSpCert;

private String vdsLdapProtocol;
private String vdsBindDn;
private String vdsLdapServer;
private String vdsBindPassword;
private String vdsFilter;
private String vdsUserField;

private String mysqlUrl;
private String mysqlUser;
private String mysqlPassword;
Expand Down Expand Up @@ -142,6 +138,8 @@ public final class ApplicationConfiguration implements Serializable {
private String umaRedirectUri;
private String umaResourceId;
private String umaScope;
private String cssLocation;
private String jsLocation;

public String getBaseDN() {
return baseDN;
Expand Down Expand Up @@ -503,60 +501,20 @@ public void setIdpBindPassword(String idpBindPassword) {
this.idpBindPassword = idpBindPassword;
}

public String getGluuSpCert() {
return gluuSpCert;
}

public void setGluuSpCert(String gluuSpCert) {
this.gluuSpCert = gluuSpCert;
}

public String getVdsLdapProtocol() {
return vdsLdapProtocol;
}

public void setVdsLdapProtocol(String vdsLdapProtocol) {
this.vdsLdapProtocol = vdsLdapProtocol;
}

public String getVdsBindDn() {
return vdsBindDn;
}

public void setVdsBindDn(String vdsBindDn) {
this.vdsBindDn = vdsBindDn;
}

public String getVdsLdapServer() {
return vdsLdapServer;
}

public void setVdsLdapServer(String vdsLdapServer) {
this.vdsLdapServer = vdsLdapServer;
}

public String getVdsBindPassword() {
return vdsBindPassword;
public String getIdpUserFields() {
return idpUserFields;
}

public void setVdsBindPassword(String vdsBindPassword) {
this.vdsBindPassword = vdsBindPassword;
public void setIdpUserFields(String idpUserFields) {
this.idpUserFields = idpUserFields;
}

public String getVdsFilter() {
return vdsFilter;
}

public void setVdsFilter(String vdsFilter) {
this.vdsFilter = vdsFilter;
}

public String getVdsUserField() {
return vdsUserField;
public String getGluuSpCert() {
return gluuSpCert;
}

public void setVdsUserField(String vdsUserField) {
this.vdsUserField = vdsUserField;
public void setGluuSpCert(String gluuSpCert) {
this.gluuSpCert = gluuSpCert;
}

public String getMysqlUrl() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ public String getIdpBindPassword() {
return applicationConfiguration.getString("idp.bindPassword");
}

public String getIdpUserFields() {
return applicationConfiguration.getString("idp.user.fields");
}

public String getGluuSpCert() {
return applicationConfiguration.getString("gluuSP.securityCert");
}
Expand All @@ -188,30 +192,6 @@ public String getApplianceUrl() {
return applicationConfiguration.getString("appliance.url");
}

public String getVdsLdapProtocol() {
return "true".equalsIgnoreCase(applicationConfiguration.getString("vds.useSSL")) ? "ldaps" : "ldap";
}

public String getVdsBindDn() {
return applicationConfiguration.getString("vds.bindDN");
}

public String getVdsLdapServer() {
return applicationConfiguration.getString("vds.ldap.server");
}

public String getVdsBindPassword() {
return applicationConfiguration.getString("vds.bindPassword");
}

public String getVdsFilter() {
return applicationConfiguration.getString("vds.test.filter");
}

public String getVdsUserField() {
return applicationConfiguration.getString("vds.userField");
}

public String getMysqlUrl() {
return applicationConfiguration.getString("mysql.url");
}
Expand Down Expand Up @@ -375,5 +355,12 @@ public String getUmaResourceId() {
public String getUmaScope() {
return applicationConfiguration.getString("uma.scope");
}


public String getCssLocation() {
return applicationConfiguration.getString("cssLocation");
}

public String getJsLocation() {
return applicationConfiguration.getString("jsLocation");
}
}
18 changes: 16 additions & 2 deletions oxService/src/main/java/org/xdi/model/GluuAttribute.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.xdi.model;

import java.io.Serializable;
import java.util.Arrays;

import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
Expand Down Expand Up @@ -31,7 +30,22 @@

@LdapAttribute(ignoreDuringUpdate = true)
private String inum;


@LdapAttribute(name = "oxAttributeType")
private String type;

@LdapAttribute
private String lifetime;

@LdapAttribute(name = "oxSourceAttribute")
private String sourceAttribute;

@LdapAttribute
private String salt;

@LdapAttribute(name = "oxNameIdType")
private String nameIdType;

@NotNull
@Pattern(regexp = "^[a-zA-Z_]+$", message = "Name should contain only letters and underscores")
@Size(min = 1, max = 30, message = "Length of the Name should be between 1 and 30")
Expand Down
2 changes: 1 addition & 1 deletion oxUtil/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.xdi</groupId>
<artifactId>oxCore</artifactId>
<version>1.1.0.Final</version>
<version>1.2.0.Final</version>
</parent>

<prerequisites>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<groupId>org.xdi</groupId>
<artifactId>oxCore</artifactId>
<packaging>pom</packaging>
<version>1.1.0.Final</version>
<version>1.2.0.Final</version>
<name>oxCore</name>
<url>http://ox.gluu.org</url>

Expand Down

0 comments on commit bb73b97

Please sign in to comment.