Permalink
Browse files

Add postgres support and and check with PLATFORM=postgresql

  • Loading branch information...
1 parent bbcf065 commit 60e128a0f9d31fd479c2e9875d046f2bb8342310 @dsyer dsyer committed Dec 1, 2011
View
@@ -34,7 +34,7 @@ stored in the file `.access_token`.
Now kill the `uaa` server and run the `api` server (which starts the
`uaa` server as well):
- $ cd api
+ $ cd samples/api
$ mvn tomcat:run
And then (from the base directory) execute:
@@ -60,13 +60,13 @@ to get the wars in your local repo first.)
## Inventory
-There are actually several projects here:
+There are actually several projects here, the main `uaa` server application and some samples:
1. `uaa` is the actual UAA server
-2. `api` is an OAuth2 resource service which returns a mock list of deployed apps
+2. `api` (sample) is an OAuth2 resource service which returns a mock list of deployed apps
-3. `app` is a user application that uses both of the above
+3. `app` (sample) is a user application that uses both of the above
In CloudFoundry terms
@@ -97,12 +97,12 @@ an access token submitted by an OAuth2 client.
4. SCIM user provisioning endpoints (todo)
-5. OpenID connect endpoints to support authentication
-(todo). Implemented roughly enough to get it working (so /app
-authenticates here), but not to meet the spec.
+5. OpenID connect endpoints to support authentication /userinfo and /check_id
+(todo). Implemented roughly enough to get it working (so /app authenticates
+here), but not to meet the spec.
Authentication can be performed by command line clients by submitting
-credentials directly to the /authorize endpoint (as described in
+credentials directly to the `/authorize` endpoint (as described in
UAA-API doc). There is an `ImplicitAccessTokenProvider` in Spring
Security OAuth that can do the heavy lifting.
View
@@ -67,17 +67,76 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>tomcat-maven-plugin</artifactId>
- <inherited>false</inherited>
- <configuration>
- <serverXml>${basedir}/server.xml</serverXml>
- <ignorePackaging>true</ignorePackaging>
- <configurationDir>${java.io.tmpdir}/uaa/tomcat</configurationDir>
- </configuration>
- </plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.7.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.7.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-apache-regexp</artifactId>
+ <version>1.7.0</version>
+ </dependency>
+ <dependency>
+ <groupId>foundrylogic.vpp</groupId>
+ <artifactId>vpp</artifactId>
+ <version>2.2.1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.springsource.bundlor</groupId>
+ <artifactId>com.springsource.bundlor.maven</artifactId>
+ <versionRange>[1.0,)</versionRange>
+ <goals>
+ <goal>bundlor</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <versionRange>[1.0,)</versionRange>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<extensions>
<extension>
<groupId>org.springframework.build.aws</groupId>
View
@@ -57,6 +57,51 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-sql</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <typedef resource="foundrylogic/vpp/typedef.properties" />
+ <taskdef resource="foundrylogic/vpp/taskdef.properties" />
+ <vppcopy todir="${basedir}/target/generated-resources" overwrite="true">
+ <config>
+ <context>
+ <property key="includes" value="src/main/sql" />
+ <property file="${basedir}/src/main/sql/hsqldb.properties" />
+ </context>
+ <engine>
+ <property key="velocimacro.library" value="src/main/sql/hsqldb.vpp" />
+ </engine>
+ </config>
+ <fileset dir="${basedir}/src/main/sql" includes="schema*.sql.vpp" />
+ <mapper type="glob" from="*.sql.vpp" to="*-hsqldb.sql" />
+ </vppcopy>
+ <vppcopy todir="${basedir}/target/generated-resources" overwrite="true">
+ <config>
+ <context>
+ <property key="includes" value="src/main/sql" />
+ <property file="${basedir}/src/main/sql/postgresql.properties" />
+ </context>
+ <engine>
+ <property key="velocimacro.library" value="src/main/sql/postgresql.vpp" />
+ </engine>
+ </config>
+ <fileset dir="${basedir}/src/main/sql" includes="schema*.sql.vpp" />
+ <mapper type="glob" from="*.sql.vpp" to="*-postgresql.sql" />
+ </vppcopy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
@@ -269,6 +314,15 @@
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb-j5</artifactId>
<version>2.0.0</version>
+ <optional>true</optional>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>9.1-901.jdbc3</version>
+ <optional>true</optional>
<scope>runtime</scope>
</dependency>
@@ -1,14 +1,30 @@
package org.cloudfoundry.identity.uaa.scim;
-import edu.vt.middleware.dictionary.ArrayWordList;
-import edu.vt.middleware.dictionary.WordList;
-import edu.vt.middleware.dictionary.WordListDictionary;
-import edu.vt.middleware.dictionary.WordLists;
-import edu.vt.middleware.password.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
import org.springframework.http.HttpStatus;
import org.springframework.util.StringUtils;
-import java.util.*;
+import edu.vt.middleware.dictionary.ArrayWordList;
+import edu.vt.middleware.dictionary.WordListDictionary;
+import edu.vt.middleware.dictionary.WordLists;
+import edu.vt.middleware.password.AlphabeticalCharacterRule;
+import edu.vt.middleware.password.AlphabeticalSequenceRule;
+import edu.vt.middleware.password.DictionarySubstringRule;
+import edu.vt.middleware.password.DigitCharacterRule;
+import edu.vt.middleware.password.LengthRule;
+import edu.vt.middleware.password.NumericalSequenceRule;
+import edu.vt.middleware.password.Password;
+import edu.vt.middleware.password.PasswordData;
+import edu.vt.middleware.password.QwertySequenceRule;
+import edu.vt.middleware.password.RegexRule;
+import edu.vt.middleware.password.RepeatCharacterRegexRule;
+import edu.vt.middleware.password.Rule;
+import edu.vt.middleware.password.RuleResult;
+import edu.vt.middleware.password.UsernameRule;
/**
* A standard password validator built using vt-password rules.
@@ -0,0 +1,3 @@
+-- Autogenerated: do not edit this file
+
+DROP TABLE USERS IF EXISTS;
@@ -0,0 +1,3 @@
+-- Autogenerated: do not edit this file
+
+DROP TABLE USERS ;
@@ -0,0 +1,14 @@
+-- Autogenerated: do not edit this file
+
+CREATE TABLE USERS (
+ id char(36) not null primary key,
+ created TIMESTAMP default current_timestamp,
+ lastModified TIMESTAMP default current_timestamp,
+ version BIGINT default 0,
+ username VARCHAR(255) not null,
+ password VARCHAR(255) not null,
+ email VARCHAR(255) not null,
+ givenName VARCHAR(255) not null,
+ familyName VARCHAR(255) not null,
+ constraint unique_uk_1 unique(username)
+) ;
@@ -0,0 +1,14 @@
+-- Autogenerated: do not edit this file
+
+CREATE TABLE USERS (
+ id char(36) not null primary key,
+ created TIMESTAMP default current_timestamp,
+ lastModified TIMESTAMP default current_timestamp,
+ version BIGINT default 0,
+ username VARCHAR(255) not null,
+ password VARCHAR(255) not null,
+ email VARCHAR(255) not null,
+ givenName VARCHAR(255) not null,
+ familyName VARCHAR(255) not null,
+ constraint unique_uk_1 unique(username)
+) ;
@@ -0,0 +1,13 @@
+platform=hsqldb
+# SQL language oddities
+BIGINT = BIGINT
+IDENTITY = IDENTITY
+IFEXISTS = IF EXISTS
+DOUBLE = DOUBLE PRECISION
+BLOB = LONGVARBINARY
+CLOB = LONGVARCHAR
+TIMESTAMP = TIMESTAMP
+VARCHAR = VARCHAR
+SYSDATE = current_timestamp
+# for generating drop statements...
+SEQUENCE = TABLE
@@ -0,0 +1,5 @@
+#macro (sequence $name $value)CREATE TABLE ${name} (
+ ID BIGINT IDENTITY
+);
+#end
+#macro (notnull $name $type)ALTER COLUMN ${name} ${type} NOT NULL#end
@@ -0,0 +1,13 @@
+platform=postgresql
+# SQL language oddities
+BIGINT = BIGINT
+IDENTITY =
+GENERATED =
+DOUBLE = DOUBLE PRECISION
+BLOB = BYTEA
+CLOB = TEXT
+TIMESTAMP = TIMESTAMP
+VARCHAR = VARCHAR
+SYSDATE = current_timestamp
+# for generating drop statements...
+SEQUENCE = SEQUENCE
@@ -0,0 +1,3 @@
+#macro (sequence $name $value)CREATE SEQUENCE ${name} MAXVALUE 9223372036854775807 NO CYCLE;
+#end
+#macro (notnull $name $type)ALTER COLUMN ${name} SET NOT NULL#end
@@ -0,0 +1,3 @@
+-- Autogenerated: do not edit this file
+
+DROP TABLE $!{IFEXISTSBEFORE} USERS $!{IFEXISTS};
@@ -0,0 +1,14 @@
+-- Autogenerated: do not edit this file
+
+CREATE TABLE USERS (
+ id char(36) not null primary key,
+ created ${TIMESTAMP} default ${SYSDATE},
+ lastModified ${TIMESTAMP} default ${SYSDATE},
+ version ${BIGINT} default 0,
+ username ${VARCHAR}(255) not null,
+ password ${VARCHAR}(255) not null,
+ email ${VARCHAR}(255) not null,
+ givenName ${VARCHAR}(255) not null,
+ familyName ${VARCHAR}(255) not null,
+ constraint unique_uk_1 unique(username)
+) $!{VOODOO};
Oops, something went wrong.

0 comments on commit 60e128a

Please sign in to comment.