Skip to content

Commit

Permalink
feat(jans-client-api): migration to Weld/Resteasy and Jetty 11 - Issu…
Browse files Browse the repository at this point in the history
…e 260 (#1319)

* feat(jans-client-api):Migration to weld/resteasy and Jetty 11

* feat(jans-client-api):include ldif insert configuration for ldap, create scripts folder

* feat(jans-client-api):README text correction

* feat(jans-client-api):dependency improvements

* feat(jans-client-api):Remove Resource for clear tests, register update remove site tests working

* feat(jans-client-api):completing tests, evaluation of working tests

* feat(jans-client-api):Adding swagger definition, mofify path (api) endpoint

* feat(jans-client-api):dinamic api-url for tests

* fix(jans-client-api):test selenium driver, solved

* fix(jans-client-api):fix tets not working

* test(jans-client-api):two ways to run tests, compiling and with external client-api url

* fix(jans-auth-server):dependencies for run locally

* fix(jans-client-api):SqlEntryManager override localizedString persistence

* fix(jans-client-api):pom server version 1.0.1

* test(jans-client-api):add new profile for jenkins build

* fix(jans-client-api):remove unnecessary customcript for jans-client-api

* fix(jans-client-api):add sonar parameters

* fix(jans-client-api):security alerts removed

* fix(jans-client-api):sonar bugs removed

* fix(jans-client-api):sonar code smells and issues removed

* feat(jans-client-api):remove unnecesary code, add swager module

* fix(jans-client-api):remove sonar issues

* fix(jans-client-api):remove jenkins profile

* feat(jans-client-api):add json config example for installer

* feat: jans-linux-setup Jans Client Api Imstaller (ref: #1490)

* fix(jans-client-api):fix sonar issues code smells

* fix: jans-linux-setup client api jetty modules

* fix: jans-linux-setup client api base dn

* fix(jans-client-api):fix Unsatisfied dependencies for type AttributeService - deploying time

* fix: jans-linux-setup fix client-api default template

* fix(jans-client-api):remove Major codeSmells

* fix(jans-client-api):minor sonar issues

* fix: jans-linux-setup remove log config for client api

* fix: jans-linux-setup client-api apache config

* fix(jans-client-api):fixing Rp persistence

* fix: jans-linux-setup client-api storage configuration

Co-authored-by: Mustafa Baser <mbaser@mail.com>
  • Loading branch information
jmunozherbas and devrimyatar committed Jun 9, 2022
1 parent 5f2be26 commit 420ffc3
Show file tree
Hide file tree
Showing 300 changed files with 7,879 additions and 10,500 deletions.
16 changes: 15 additions & 1 deletion jans-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<jakarta.mail.api.version>2.0.1</jakarta.mail.api.version>
<jakarta.websocket.api.version>2.0.0</jakarta.websocket.api.version>
<jakarta.xml.bind.api.version>3.0.0</jakarta.xml.bind.api.version>
<org.glassfish.jakarta.el.api.version>5.0.0-M1</org.glassfish.jakarta.el.api.version>
<jakarta.el.api.version>5.0.0-RC1</jakarta.el.api.version>
<!-- <jsf-api.version>2.2.20</jsf-api.version> -->
<!-- <jsf-impl.version>3.0.0</jsf-impl.version> -->
<!-- <uel-api.version>2.2.1-b04</uel-api.version> -->
Expand Down Expand Up @@ -331,11 +333,17 @@
</dependency> -->

<!-- glassfish -->
<!-- <dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.el</artifactId>
<version>${org.glassfish.jakarta.el.api.version}</version>
</dependency>
<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>${jakarta.el.api.version}</version>
</dependency>
<!-- <dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.faces</artifactId>
</dependency> -->
Expand Down Expand Up @@ -601,6 +609,12 @@
<artifactId>resteasy-json-p-provider</artifactId>
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-core-spi</artifactId>
<version>${resteasy.version}</version>
</dependency>

<!-- <dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
Expand Down
77 changes: 53 additions & 24 deletions jans-client-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,75 @@

jans-client-api is a middleware service which can be used by web application developers to facilitate user authentication and authorization with an external [OAuth 2.0](https://tools.ietf.org/html/rfc6749) identity provider. It includes the server which is a simple REST application designed to work over the web (via https), making it possible for many apps across many servers to leverage a central jans-client-api service for [OAuth 2.0](https://tools.ietf.org/html/rfc6749) security.

## Installation

### Source Install

If you're a Java geek, you can build the jans-client-api server using [Maven](https://maven.apache.org). The code is available in [Github](https://github.com/JanssenProject/jans-client-api).

## Packaging and running the application
### Prerequisites
- A working installation of jans-auth-server
### Verify jans-auth-server necessary configuration
1. Verify configurationEntryDN in jans.properties
```
git clone https://github.com/JanssenProject/jans-client-api.git
cd jans-client-api
mvn clean install -X
clientApi_ConfigurationEntryDN=ou=jans-client-api,ou=configuration,o=jans
```
2. Verify `clientApi_ConfigurationEntryDN` in DB configuration, if not exist execute respective insert.

After the built is finished `jans-client-api-server-distribution.zip` is generated in `${JANS_CLIENT_API_HOME}/server/target/`.
- [MySql](https://github.com/JanssenProject/jans-client-api/blob/master/server/scripts/mysql/clientApi_ConfigurationEntryDN.sql)
- [Ldap](https://github.com/JanssenProject/jans-client-api/blob/master/server/scripts/ldap/clientApi_ConfigurationEntryDN.ldif)

### Maven Repository
3. Verify file route of next parameters in `clientApi_ConfigurationEntryDN` field:`jansConfDyn` configuration json:
```
"keyStorePath"
"cryptProviderKeyStorePath"
"mtlsClientKeyStorePath"
"storageConfiguration"
```

The distribution zip can be directly downloaded from maven repository `https://maven.jans.io/maven/io/jans/jans-client-api-server/<version>/jans-client-api-server-<version>-distribution.zip`.
### Source Packaging

#### To run jans-client-api-server:
You can build the jans-client-api server using [Maven](https://maven.apache.org). The code is available in [Github](https://github.com/JanssenProject/jans-client-api).

1. Create a new directory ($JANS_CLIENT_API_SERVER_HOME) with appropriate name and unzip the downloaded `jans-client-api-server-<version>-distribution.zip` into it.
Create a folder to clone ${PATH_REPOSITORY}, and clone inside.
```
cd ${PATH_REPOSITORY}
git clone https://github.com/JanssenProject/jans-client-api.git
cd jans-client-api
mvn clean install -Dmaven.test.skip=true -Dcompile.jans.base={JANS_AUTH_SERVER_CONFIG_PATH, example: /etc/jans}
```

1. Change directory to `$JANS_CLIENT_API_SERVER_HOME/conf` folder and edit client-api-server.yml file to make necessary configuration changes (like setting correct absolute path of `client-api-server.keystore` in keyStorePath property etc.)
After the built is finished `jans-client-api-server.war` is generated in `${PATH_REPOSITORY}/jans-client-api/server/target/`.

1. Now go to $JANS_CLIENT_API_SERVER_HOME/bin folder and start server using below command.
### Jetty 11 Deploy

Windows:
Download jetty 11 zip, here a link:
https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/11.0.9/jetty-home-11.0.9.zip

Create a folder to unzip Jetty ${PATH_FOLDER_JETTY}, and unzip Jetty inside.
```
client-api-start.bat
cd ${PATH_FOLDER_JETTY}
export JETTY_HOME=${PATH_FOLDER_JETTY}/jetty-home-11.0.9
mkdir jetty-base
export JETTY_BASE=${PATH_FOLDER_JETTY}/jetty-base/
cd jetty-base
java -jar $JETTY_HOME/start.jar --add-module=server,deploy,annotations,webapp,servlet,resources,http,http-forwarded,threadpool,jsp,websocket,logging/slf4j,logging-jetty
cp ${PATH_REPOSITORY}/jans-client-api/server/target/jans-client-api-server.war $JETTY_BASE/webapps/
java -jar $JETTY_HOME/start.jar jetty.http.port=9999
```
After `jans-client-api` server is started, status can be checked using `health-check` url: http://localhost:9999/jans-client-api-server/health-check.

Linux:

## Compile and running tests
### Compile with tests
```
sh client-api-start.sh
mvn clean install -Djans.base=/etc/jans
```

After `jans-client-api` server is started, status can be checked using `health-check` url: https://localhost:8443/health-check.
`Djans.base` is the conf path of the local running `jans-auth-server`
### Running tests
```
mvn test -Djans.base=/etc/jans
```
`Djans.base` is the conf path of the local running `jans-auth-server`
### Running tests with external jans-client-api
```
mvn test -Dtest.client.api.url=http://localhost:9999/jans-client-api-server/
```
`Dtest.client.api.url` is the url of a running `jans-client-api-server`

## Api Description

Expand Down Expand Up @@ -73,7 +103,6 @@ HTTP request | Method | Description
/get-request-object-uri | POST | Get Request Object Uri.
/get-request-object/{request_object_id} | GET | Get Request Object.

## Swagger

jans-client-api has defined swagger specification [here](https://gluu.org/swagger-ui/?url=https://raw.githubusercontent.com/JanssenProject/jans-client-api/master/server/src/main/resources/swagger.yaml). It is possible to generated native library in your favorite language by [Swagger Code Generator](https://swagger.io/tools/swagger-codegen/).

20 changes: 9 additions & 11 deletions jans-client-api/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>io.jans</groupId>
<artifactId>jans-client-api-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.1-SNAPSHOT</version>
</parent>

<properties>
Expand Down Expand Up @@ -107,20 +107,18 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-proxy-client</artifactId>
<version>${jersey.version}</version>
</dependency>

<dependency>
<groupId>io.jans</groupId>
<artifactId>jans-client-api-common</artifactId>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>

</dependencies>

</project>
Loading

0 comments on commit 420ffc3

Please sign in to comment.