initial ldap service, LdapUserVO

This commit is contained in:
Peter Hormanns 2018-08-24 19:56:54 +02:00
parent 83e8edc328
commit 3336715ed6
6 changed files with 371 additions and 0 deletions

14
ldap-services/.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
*.class
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target
/.settings
/.classpath
/.project
/derby.log

197
ldap-services/pom.xml Normal file
View File

@ -0,0 +1,197 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>ldap-webapp</artifactId>
<packaging>war</packaging>
<name>HSAdmin XML-RPC LDAP Account Webapp</name>
<dependencies>
<dependency>
<groupId>de.hsadmin</groupId>
<artifactId>framework</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.hsadmin</groupId>
<artifactId>framework</artifactId>
<version>1.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-ejb_3.0_spec</artifactId>
<version>1.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-validation_1.0_spec</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>org.apache.bval.bundle</artifactId>
<version>0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>2.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.5.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>xmlrpc-server</artifactId>
<version>3.1.3</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<archiveClasses>true</archiveClasses>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>3.0.2</version>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/XmlRpcServlet.properties</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>make-a-jar</id>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.basedir}/target/ldap-webapp-1.0-SNAPSHOT.jar</file>
<type>jar</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>migratePostgresLiquibaseChangeLogToH2</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${project.basedir}/scripts/migratePostgresLiquibaseChangeLogToH2.${script.extension}</executable>
<arguments>
<argument>${project.parent.basedir}/db-migration/src/main/resources/liquibase/db.changelog.xml</argument>
<argument>${project.build.directory}/classes/liquibase/db.changelog.xml</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.openejb.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>1.7.4</version>
<configuration>
<tomeeVersion>1.7.4</tomeeVersion>
<tomeeClassifier>webprofile</tomeeClassifier>
<debug>false</debug>
<debugPort>8000</debugPort>
<context>ldap-webapp</context>
<config>${project.basedir}/src/test/tomee/conf</config>
<libs>
<lib>org.postgresql:postgresql:9.4.1212.jre7</lib>
</libs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<includes>**/bo/*.class</includes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
</configuration>
<executions>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<!-- set the version to be the same as the level in your runtime -->
<version>2.4.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,16 @@
package de.hsadmin.service.ldap;
import javax.ejb.Stateless;
import de.hsadmin.common.error.TechnicalException;
import de.hsadmin.module.impl.AbstractModule;
@Stateless
public class LdapUserService extends AbstractModule<LdapUserVO> implements LdapUserServiceLocal {
@Override
public LdapUserVO buildVO() throws TechnicalException {
return new LdapUserVO();
}
}

View File

@ -0,0 +1,10 @@
package de.hsadmin.service.ldap;
import javax.ejb.Local;
import de.hsadmin.module.Module;
@Local
public interface LdapUserServiceLocal extends Module<LdapUserVO> {
}

View File

@ -0,0 +1,133 @@
package de.hsadmin.service.ldap;
import javax.validation.constraints.Pattern;
import de.hsadmin.common.error.TechnicalException;
import de.hsadmin.module.impl.AbstractVO;
import de.hsadmin.module.property.ReadWrite;
import de.hsadmin.module.property.ReadWritePolicy;
import de.hsadmin.module.property.Required;
import de.hsadmin.module.property.Search;
import de.hsadmin.module.property.SearchPolicy;
public class LdapUserVO extends AbstractVO {
@Required(true)
@ReadWrite(ReadWritePolicy.WRITEONCE)
@Search(SearchPolicy.EQUALS)
@Pattern(regexp="[a-z0-9]{3}\\-[a-z0-9]+")
private String uid;
@ReadWrite(ReadWritePolicy.READWRITE)
private String userPassword;
@Required(true)
@ReadWrite(ReadWritePolicy.READWRITE)
@Search(SearchPolicy.EQUALS)
private String sn;
@ReadWrite(ReadWritePolicy.READWRITE)
@Search(SearchPolicy.EQUALS)
private String givenName;
@Required(true)
@ReadWrite(ReadWritePolicy.READWRITE)
@Search(SearchPolicy.EQUALS)
@Pattern(regexp="[a-zA-Z0-9\\.\\-\\_]*@[a-z0-9äöüß\\.\\-]*")
private String mail;
@ReadWrite(ReadWritePolicy.READWRITE)
@Pattern(regexp="[\\+\\d\\-\\ \\(\\)\\/]*")
private String mobile;
@ReadWrite(ReadWritePolicy.READWRITE)
@Pattern(regexp="[\\+\\d\\-\\ \\(\\)\\/]*")
private String homePhone;
@ReadWrite(ReadWritePolicy.READWRITE)
@Search(SearchPolicy.EQUALS)
@Pattern(regexp="[a-z0-9]*")
private String nickName;
@ReadWrite(ReadWritePolicy.READWRITE)
private String[] sshPublicKey;
public LdapUserVO() throws TechnicalException {
super();
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public String getGivenName() {
return givenName;
}
public void setGivenName(String givenName) {
this.givenName = givenName;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getHomePhone() {
return homePhone;
}
public void setHomePhone(String homePhone) {
this.homePhone = homePhone;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String[] getSshPublicKey() {
return sshPublicKey;
}
public void setSshPublicKey(String[] sshPublicKey) {
this.sshPublicKey = sshPublicKey;
}
}

View File

@ -21,6 +21,7 @@
<module>db-migration</module>
<module>framework</module>
<module>cust-services</module>
<module>ldap-services</module>
<module>database-services</module>
<module>web</module>
<module>cli</module>