Skip to content

Commit 5d5ed31

Browse files
author
Ellet
committed
Breaking changes
1 parent 474118b commit 5d5ed31

File tree

26 files changed

+226
-94
lines changed

26 files changed

+226
-94
lines changed

.github/ISSUE_TEMPLATE/1_bug.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Report a bug
2+
description: |
3+
You found a bug in the library causing your application to crash or
4+
throw an exception, a feature is buggy, unexpected behavior or something looks wrong.
5+
labels: 'bug'
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
Thank you for using the library!
11+
12+
- type: checkboxes
13+
attributes:
14+
label: Is there an existing issue for this?
15+
options:
16+
- label: I have searched the [existing issues](https://github.com/freshtechtips/ktor-server-firebase-app-check/issues)
17+
required: true
18+
- type: textarea
19+
attributes:
20+
label: Steps to reproduce
21+
description: Please tell us exactly how to reproduce the problem you are running into.
22+
placeholder: |
23+
1. ...
24+
2. ...
25+
3. ...
26+
validations:
27+
required: true
28+
- type: textarea
29+
attributes:
30+
label: Expected results
31+
description: Please tell us what is expected to happen.
32+
validations:
33+
required: true
34+
- type: textarea
35+
attributes:
36+
label: Actual results
37+
description: Please tell us what is actually happening.
38+
validations:
39+
required: true
40+
- type: textarea
41+
attributes:
42+
label: Code sample
43+
description: |
44+
Please create a minimal reproducible sample that shows the problem
45+
and attach it below between the lines with the backticks.
46+
47+
To create it, use the [Ktor project generator](https://start.ktor.io/)
48+
49+
Note: Please do not upload screenshots of text. Instead, use code blocks
50+
or the above mentioned ways to upload your code sample.
51+
value: |
52+
<details><summary>Code sample</summary>
53+
54+
```kotlin
55+
[Paste your code here]
56+
```
57+
58+
</details>
59+
validations:
60+
required: true
61+
- type: textarea
62+
attributes:
63+
label: Screenshots or Video
64+
description: |
65+
Upload any screenshots or video of the bug if applicable.
66+
value: |
67+
<details>
68+
<summary>Screenshots / Video demonstration</summary>
69+
70+
[Upload media here]
71+
72+
</details>
73+
- type: textarea
74+
attributes:
75+
label: Logs
76+
description: |
77+
Include the full logs of the commands you are running between the lines
78+
with the backticks below.
79+
80+
If the logs are too large to be uploaded to GitHub, you may upload
81+
them as a `txt` file or use online tools like https://pastebin.com to
82+
share it.
83+
84+
Note: Please do not upload screenshots of text. Instead, use code blocks
85+
or the above mentioned ways to upload logs.
86+
value: |
87+
<details><summary>Logs</summary>
88+
89+
```console
90+
[Paste your logs here]
91+
```
92+
93+
</details>
94+
- type: textarea
95+
attributes:
96+
label: Gradle version output (optional)
97+
description: |
98+
Please provide the full output of running `gradle --version`
99+
if the issue is related on how the library use Gradle
100+
value: |
101+
<details><summary>Doctor output</summary>
102+
103+
```console
104+
[Paste your output here]
105+
```
106+
107+
</details>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Feature request
2+
description: Suggest a new idea.
3+
labels: 'enhancement'
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thank you for using the library!
9+
10+
- type: checkboxes
11+
attributes:
12+
label: Is there an existing issue for this?
13+
description: Please search to see if an issue already exists for this feature request or proposal.
14+
options:
15+
- label: I have searched the [existing issues](https://github.com/freshtechtips/ktor-server-firebase-app-check/issues)
16+
required: true
17+
- type: textarea
18+
attributes:
19+
label: Use case
20+
description: |
21+
Please tell us the problem you are running into that led to you wanting
22+
a new feature.
23+
24+
Is your feature request related to a problem? Please give a clear and
25+
concise description of what the problem is.
26+
27+
Describe the alternative solutions you've considered. Is there already a solution that solves this?
28+
validations:
29+
required: true
30+
- type: textarea
31+
attributes:
32+
label: Proposal
33+
description: |
34+
Briefly but precisely describe what you would like the library to be able to do.
35+
36+
Consider attaching something showing what you are imagining:
37+
* images
38+
* videos
39+
* code samples
40+
validations:
41+
required: true

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
## [next]
22

3+
## 0.0.3-experimental
4+
* **Breaking Change**: Now you don't need to pass configuration class as value, just add the properties directly
5+
* **Breaking change**: The `FirebaseAppCheckPlugin` has been moved to the root `kotlin` folder
6+
* Separate the `src` to a module
7+
* Include the `example` in the `settings.gradle.kts`
8+
* Update the `build.gradle.kts` of the `example`
9+
310
## 0.0.2-experimental
411
* Rename the folder `examples` to `example` and use only one example project
512
* Use latest version of kotlin `1.9.20`

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,19 @@ Pass the following environment variables,
7070
7171
```kotlin
7272
install(FirebaseAppCheckPlugin) {
73-
configuration = FirebaseAppCheckPluginConfiguration(
74-
firebaseProjectNumber = System.getenv("FIREBASE_PROJECT_NUMBER"),
75-
firebaseProjectId = System.getenv("FIREBASE_PROJECT_ID"),
76-
isShouldVerifyToken = true,
77-
secureStrategy = FirebaseAppCheckSecureStrategy.ProtectSpecificRoutes,
78-
pluginMessagesBuilder = { configuration ->
79-
// Example of override a response message
80-
FirebaseAppCheckMessages(
81-
configuration,
82-
appCheckIsNotDefinedResponse = mapOf(
83-
"error" to "${configuration.firebaseAppCheckHeaderName} is required"
84-
),
85-
)
86-
}
87-
)
73+
firebaseProjectNumber = System.getenv("FIREBASE_PROJECT_NUMBER")
74+
firebaseProjectId = System.getenv("FIREBASE_PROJECT_ID")
75+
isShouldVerifyToken = true
76+
secureStrategy = FirebaseAppCheckSecureStrategy.ProtectSpecificRoutes
77+
pluginMessagesBuilder = { configuration ->
78+
// Example of override a response message
79+
FirebaseAppCheckMessages(
80+
configuration,
81+
appCheckIsNotDefinedResponse = mapOf(
82+
"error" to "${configuration.firebaseAppCheckHeaderName} is required"
83+
),
84+
)
85+
}
8886
}
8987
```
9088

docs/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This page will be updated in the future.
88

99
## Steps to contributing
1010

11-
You will need GitHub account as well git installed and configured with your GitHub account on your machine
11+
You will need GitHub account as well as git installed and configured with your GitHub account on your machine
1212

1313
1. Fork the repository in GitHub
1414
2. clone the forked repository using `git`

example/build.gradle.kts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11

2-
val ktor_version: String by project
3-
val kotlin_version: String by project
4-
val logback_version: String by project
2+
val kotlinVersion = extra["kotlin.version"] as String
3+
val ktorVersion = extra["ktor.version"] as String
4+
val logbackVersion = extra["logback.version"] as String
5+
val auth0JwksRsaVersion = extra["auth0JwksRsa.version"] as String
6+
val auth0JavaJwtVersion = extra["auth0JavaJwt.version"] as String
57

68
plugins {
7-
kotlin("jvm") version "1.9.20"
8-
id("io.ktor.plugin") version "2.3.5"
9-
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.20"
9+
kotlin("jvm")
10+
id("io.ktor.plugin")
11+
id("org.jetbrains.kotlin.plugin.serialization")
1012
}
1113

1214
group = "net.freshplatform"
@@ -21,8 +23,7 @@ application {
2123

2224
repositories {
2325
mavenCentral()
24-
mavenLocal() // Comment this if you are using jitpack
25-
// Add jitpack repository if you are not using the mavenLocal()
26+
// mavenLocal()
2627
// maven {
2728
// name = "jitpack"
2829
// setUrl("https://jitpack.io")
@@ -40,9 +41,9 @@ dependencies {
4041
implementation("io.ktor:ktor-server-content-negotiation-jvm")
4142
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm")
4243
implementation("io.ktor:ktor-server-netty-jvm")
43-
implementation("ch.qos.logback:logback-classic:$logback_version")
44+
implementation("ch.qos.logback:logback-classic:$logbackVersion")
4445
testImplementation("io.ktor:ktor-server-tests-jvm")
45-
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
46+
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion")
4647

47-
implementation("com.github.freshtechtips:ktor-server-firebase-app-check:0.0.2-experimental")
48+
implementation(project(":library"))
4849
}

example/gradle.properties

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
package net.freshplatform.plugins
22

33
import io.ktor.server.application.*
4-
import net.freshplatform.ktor_server.firebase_app_check.core.FirebaseAppCheckPlugin
5-
import net.freshplatform.ktor_server.firebase_app_check.core.FirebaseAppCheckPluginConfiguration
4+
import net.freshplatform.ktor_server.firebase_app_check.FirebaseAppCheckPlugin
65
import net.freshplatform.ktor_server.firebase_app_check.core.FirebaseAppCheckSecureStrategy
76
import net.freshplatform.ktor_server.firebase_app_check.utils.FirebaseAppCheckMessages
87

98
fun Application.configureAppCheck() {
109
install(FirebaseAppCheckPlugin) {
11-
configuration = FirebaseAppCheckPluginConfiguration(
12-
firebaseProjectNumber = System.getenv("FIREBASE_PROJECT_NUMBER")
13-
?: throw MissingEnvironmentVariableException("FIREBASE_PROJECT_NUMBER"),
14-
firebaseProjectId = System.getenv("FIREBASE_PROJECT_ID")
15-
?: throw MissingEnvironmentVariableException("FIREBASE_PROJECT_ID"),
16-
isShouldVerifyToken = true,
17-
secureStrategy = FirebaseAppCheckSecureStrategy.ProtectSpecificRoutes,
18-
pluginMessagesBuilder = { configuration ->
19-
// Example of override a response message
20-
FirebaseAppCheckMessages(
21-
configuration,
22-
appCheckIsNotDefinedResponse = mapOf(
23-
"error" to "${configuration.firebaseAppCheckHeaderName} is required"
24-
),
25-
)
26-
}
27-
)
10+
firebaseProjectNumber = System.getenv("FIREBASE_PROJECT_NUMBER")
11+
?: throw MissingEnvironmentVariableException("FIREBASE_PROJECT_NUMBER")
12+
firebaseProjectId = System.getenv("FIREBASE_PROJECT_ID")
13+
?: throw MissingEnvironmentVariableException("FIREBASE_PROJECT_ID")
14+
isShouldVerifyToken = true
15+
secureStrategy = FirebaseAppCheckSecureStrategy.ProtectSpecificRoutes
16+
pluginMessagesBuilder = { configuration ->
17+
// Example of override a response message
18+
FirebaseAppCheckMessages(
19+
configuration,
20+
appCheckIsNotDefinedResponse = mapOf(
21+
"error" to "${configuration.firebaseAppCheckHeaderName} is required"
22+
),
23+
)
24+
}
2825
}
2926
}

example/src/main/kotlin/net/freshplatform/plugins/Routing.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import io.ktor.server.application.*
55
import io.ktor.server.plugins.statuspages.*
66
import io.ktor.server.response.*
77
import io.ktor.server.routing.*
8-
import net.freshplatform.ktor_server.firebase_app_check.core.FirebaseAppCheckPlugin
9-
import net.freshplatform.ktor_server.firebase_app_check.core.FirebaseAppCheckPluginConfiguration
10-
import net.freshplatform.ktor_server.firebase_app_check.core.FirebaseAppCheckSecureStrategy
11-
import net.freshplatform.ktor_server.firebase_app_check.utils.FirebaseAppCheckMessages
128
import net.freshplatform.ktor_server.firebase_app_check.utils.extensions.protectRouteWithAppCheck
139

1410
class MissingEnvironmentVariableException(variableName: String) :

gradle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
kotlin.code.style=official
22
# Versions
3+
4+
# Shared
35
kotlin.version=1.9.20
46
ktor.version=2.3.5
7+
8+
# Example
59
logback.version=1.4.11
10+
11+
# Library
612
auth0JwksRsa.version=0.22.1
713
auth0JavaJwt.version=4.4.0

gradlew

100644100755
File mode changed.

jitpack.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
jdk:
22
- openjdk17
3-
#before_install:
4-
# - ./scripts/prepareJitpackEnvironment.sh
3+
before_install:
4+
- ./scripts/prepareJitpackEnvironment.sh
5+
- ./gradlew build
6+
- ./gradlew publishToMavenLocal
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
val kotlinVersion = extra["kotlin.version"] as String
22
val ktorVersion = extra["ktor.version"] as String
3-
val logbackVersion = extra["logback.version"] as String
43
val auth0JwksRsaVersion = extra["auth0JwksRsa.version"] as String
54
val auth0JavaJwtVersion = extra["auth0JavaJwt.version"] as String
65

76
plugins {
87
kotlin("jvm")
98
id("io.ktor.plugin")
109
id("maven-publish")
10+
id("java-library")
1111
}
1212

1313
group = "net.freshplatform.ktor_server.firebase_app_check"
14-
version = "0.0.2-experimental"
14+
version = "0.0.3-experimental"
1515
description = "A Ktor server plugin for configuring Firebase App Check easily and with simplicity. It is not affiliated with Firebase or Google and may not be suitable for production use yet."
1616
extra["experimental"] = true
1717

18-
application {
19-
mainClass.set("${group}.FirebaseAppCheckKt")
20-
21-
val isDevelopment: Boolean = project.ext.has("development")
22-
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
23-
}
24-
2518
repositories {
2619
mavenCentral()
2720
}
@@ -35,16 +28,14 @@ dependencies {
3528
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion")
3629
}
3730

31+
val jitpackGroupId = "com.github.freshtechtips"
3832

3933
publishing {
4034
publications {
41-
// create<MavenPublication>("mavenJava") {
42-
// from(components["java"])
43-
// }
4435
create<MavenPublication>("jitpack") {
4536
from(components["java"])
4637

47-
groupId = "com.github.freshtechtips"
38+
groupId = jitpackGroupId
4839
artifactId = "ktor-server-firebase-app-check"
4940
version = project.version.toString()
5041
}
@@ -55,6 +46,7 @@ publishing {
5546
maven {
5647
name = "jitpack"
5748
setUrl("https://jitpack.io")
49+
content { includeGroup(jitpackGroupId) }
5850
}
5951
}
6052
}

0 commit comments

Comments
 (0)