Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of the JWT policy #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ hs_err_pid*

# Maven files
/target/
./target/*

# Idea files
/.idea/
*.iml

# Eclipse files (no comment please ;)
.classpath
.project
.settings/
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# JWT Gravitee Policy

Here you can document your JWT Gravitee Policy.

Current policy use distributed cache (hazelcast)
To run the policy you need to start cache before starting the gateway
152 changes: 152 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (C) 2015 The Gravitee team (http://gravitee.io)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.gravitee.policy</groupId>
<artifactId>gravitee-policy-jwt</artifactId>
<version>1.0.1-SNAPSHOT</version>

<name>JWT Gravitee Policy</name>
<description>Description of the JWT Gravitee Policy</description>

<parent>
<groupId>io.gravitee</groupId>
<artifactId>gravitee-parent</artifactId>
<version>5</version>
</parent>

<properties>
<gravitee-gateway-api.version>0.12.0</gravitee-gateway-api.version>
<gravitee-policy-api.version>0.9.0</gravitee-policy-api.version>
<gravitee-common.version>0.10.0</gravitee-common.version>
<gravitee-resource-api.version>0.1.0</gravitee-resource-api.version>
<gravitee-repository.version>0.15.0-SNAPSHOT</gravitee-repository.version>
<junit.version>4.12</junit.version>
<jjwt.version>0.6.0</jjwt.version>

<json-schema-generator-maven-plugin.version>1.1.0</json-schema-generator-maven-plugin.version>
<json-schema-generator-maven-plugin.outputDirectory>${project.build.directory}/schemas</json-schema-generator-maven-plugin.outputDirectory>

<maven-assembly-plugin.version>2.5.5</maven-assembly-plugin.version>
</properties>

<dependencies>
<!-- Provided scope -->
<dependency>
<groupId>io.gravitee.gateway</groupId>
<artifactId>gravitee-gateway-api</artifactId>
<version>${gravitee-gateway-api.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.gravitee.policy</groupId>
<artifactId>gravitee-policy-api</artifactId>
<version>${gravitee-policy-api.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.gravitee.common</groupId>
<artifactId>gravitee-common</artifactId>
<version>${gravitee-common.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.gravitee.resource</groupId>
<artifactId>gravitee-resource-api</artifactId>
<version>${gravitee-resource-api.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.gravitee.repository</groupId>
<artifactId>gravitee-repository</artifactId>
<version>${gravitee-repository.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
</dependency>

<!-- Test scope -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/assembly/policy-assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-policy-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
59 changes: 59 additions & 0 deletions src/assembly/policy-assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!--

Copyright (C) 2015 The Gravitee team (http://gravitee.io)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>policy</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>

<!-- Include the main Policy Jar file -->
<files>
<file>
<source>${project.build.directory}/${project.build.finalName}.jar</source>
</file>
</files>

<fileSets>
<!-- Then include Policy configuration schemas -->
<fileSet>
<directory>src/main/resources/schemas</directory>
<outputDirectory>schemas</outputDirectory>
</fileSet>

<!-- Create the empty lib directory in case of no libraries is required -->
<!-- As there is no maven-assembly-plugin's method do to that, we hack it ourself -->
<fileSet>
<directory>${project.basedir}/src/assembly</directory>
<outputDirectory>lib</outputDirectory>
<excludes>
<exclude>*</exclude>
</excludes>
</fileSet>
</fileSets>

<!-- Finally include Policy dependencies -->
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
</dependencySet>
</dependencySets>
</assembly>
Loading