Skip to content

Commit c1102c2

Browse files
committed
update readme, add db init script link, add package and java overwrite config command.
1 parent 324da63 commit c1102c2

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

README.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
# build and test notes
2-
Build a spring boot oauth server with postgresql db.
2+
Build a spring boot oauth server with mariadb or postgresql db.
33

4-
There is a bug in spring-security-oauth2-authorization-server v0.2.3 (or it's dependency) to connect mysql. not sure that is it fixed in later version.
4+
init schema
5+
- [mariadb/1.2.7-schema.sql](mariadb/1.2.7-schema.sql)
6+
- [postgresql/script/init-db.sh](postgresql/script/init-db.sh), for container env initialize.
57

6-
## docker ide
7-
linux container
8+
## develop and running app
9+
defualt `application.properties` connect to mariadb; if you run on dev container / gitpod, replace all datasource config in every `application.properties`
810

9-
$> docker-composer up -d # create env
10-
$> docker-composer start # rerun env
11-
$> docker-composer stop # stop env
12-
$> docker-composer down # delete env
13-
14-
visit localhost:9000 for IDE interface, login password "admin"
11+
```
12+
spring.datasource.url=jdbc:postgresql://postgresqldb:5432/authorization_server
13+
spring.datasource.username=postgres
14+
spring.datasource.password=example
15+
spring.datasource.driver-class-name=org.postgresql.Driver
16+
```
1517

16-
## running app in docker
1718
running ssoserver (it is an authenication server) at localhost:8081/auth
1819
```bash
1920
cd ssoserver/npmLib
@@ -32,10 +33,25 @@ mvn spring-boot:run -pl role-server -am
3233

3334
running ssoclient (it is a client server, with server side authentication) at ***127.0.0.1:8080*** . because of redirect-uri in db is marked as 127.0.0.1, it cannot change to localhost. it will input username:password at localhost:8081/auth, and check role through localhost:8082/res
3435
```bash
35-
cp ssoclient/src/main/filters-example.properties ssoclient/src/main/filters-dev.properties
3636
mvn spring-boot:run -pl ssoclient -am
3737
```
3838

39+
## package and run war file
40+
```bash
41+
cd ssoserver/npmLib && npm ci && npm run postbuild && cd ../../
42+
mvn clean compile package
43+
cp role-server/target/*.war role-server.war
44+
cp ssoserver/target/*.war ssoserver.war
45+
46+
touch application-sso.properties
47+
# add db connection, server.port, server.servlet.context-path on application-sso.properties to overwrite default value
48+
java -jar ssoserver.war --spring.profiles.active=sso
49+
50+
touch application-role.properties
51+
# add db connection, server.port, server.servlet.context-path on application-role.properties to overwrite default value
52+
java -jar role-server.war --spring.profiles.active=role
53+
```
54+
3955
## testing command
4056

4157
### test client_credentials authentication
@@ -138,3 +154,4 @@ curl -X POST \
138154
139155
{"access_token":"6e58306a-c371-4aa8-9dac-80083c7aab7f","token_type":"bearer","refresh_token":"d14c9aca-d7ab-49e6-bd05-5705aa6927d6","expires_in":10799,"scope":"read write"}
140156
```
157+

0 commit comments

Comments
 (0)