Skip to content

Commit

Permalink
add jwt reflect and resource config to support jwt authentication type
Browse files Browse the repository at this point in the history
  • Loading branch information
atomfrede committed Aug 21, 2022
1 parent 2b991ab commit 493c0d8
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 0 deletions.
6 changes: 6 additions & 0 deletions generators/server/__snapshots__/generator.spec.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ Object {
"src/main/resources/.h2.server.properties": Object {
"stateCleared": "modified",
},
"src/main/resources/META-INF/native-image/jwt/reflect-config.json": Object {
"stateCleared": "modified",
},
"src/main/resources/META-INF/native-image/jwt/resource-config.json": Object {
"stateCleared": "modified",
},
"src/main/resources/META-INF/native-image/liquibase/reflect-config.json": Object {
"stateCleared": "modified",
},
Expand Down
12 changes: 12 additions & 0 deletions generators/server/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,18 @@ logging:
);
},

async jwt({ application: { authenticationTypeOauth2 } }) {
if (authenticationTypeOauth2) return;
await this.copyTemplate(
'src/main/resources/META-INF/native-image/jwt/reflect-config.json',
'src/main/resources/META-INF/native-image/jwt/reflect-config.json'
);
await this.copyTemplate(
'src/main/resources/META-INF/native-image/jwt/resource-config.json',
'src/main/resources/META-INF/native-image/jwt/resource-config.json'
);
},

async liquibase({ application: { databaseTypeSql } }) {
if (!databaseTypeSql) return;
await this.copyTemplate(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[
{
"name": "io.jsonwebtoken.impl.compression.GzipCompressionCodec",
"methods": [
{
"name": "<init>",
"parameterTypes": []
}
]
},
{
"name": "io.jsonwebtoken.impl.compression.DeflateCompressionCodec",
"methods": [
{
"name": "<init>",
"parameterTypes": []
}
]
},
{
"name": "io.jsonwebtoken.impl.DefaultJwtParserBuilder",
"methods": [
{
"name": "<init>",
"parameterTypes": []
}
]
},
{
"name": "io.jsonwebtoken.impl.DefaultJwtBuilder",
"methods": [
{
"name": "<init>",
"parameterTypes": []
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"resources": [
{
"pattern": "META-INF/services/io.jsonwebtoken.CompressionCodec"
},
{
"pattern": "META-INF/services/io.jsonwebtoken.io.Deserializer"
},
{
"pattern": "META-INF/services/io.jsonwebtoken.io.Serializer"
}
]
}
36 changes: 36 additions & 0 deletions test-integration/samples/postgresql-mvc-jwt.jdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
application {
config {
applicationType monolith
cacheProvider no
creationTimestamp 1632872179205
devDatabaseType h2Disk
enableHibernateCache false
enableTranslation false
testFrameworks [cypress]
}

entities Blog, Post, Tag
}

entity Blog {
name String required minlength(3)
handle String required minlength(2)
}

entity Post {
title String required
content TextBlob required
date Instant required
}

entity Tag {
name String required minlength(2)
}

relationship ManyToOne {
Post{blog(name)} to Blog
}

relationship ManyToMany {
Post{tag(name)} to Tag{entry}
}
35 changes: 35 additions & 0 deletions test-integration/samples/postgresql-webflux-jwt.jdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
application {
config {
applicationType monolith
authenticationType oauth2
creationTimestamp 1632872179205
reactive true
enableTranslation false
testFrameworks [cypress]
}

entities Blog, Post, Tag
}

entity Blog {
name String required minlength(3)
handle String required minlength(2)
}

entity Post {
title String required
content TextBlob required
date Instant required
}

entity Tag {
name String required minlength(2)
}

relationship ManyToOne {
Post{blog(name)} to Blog
}

relationship ManyToMany {
Post{tag(name)} to Tag{entry}
}

0 comments on commit 493c0d8

Please sign in to comment.