Skip to content

Commit

Permalink
feat: allow setting typ header for signed jwts, update sd-jwt lib
Browse files Browse the repository at this point in the history
  • Loading branch information
severinstampler committed Oct 10, 2023
1 parent c7cb9d0 commit 38ea68f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
}

group = "id.walt"
version = "1.SNAPSHOT"
version = "1.JWTTYP"

repositories {
mavenCentral()
Expand All @@ -40,7 +40,7 @@ dependencies {
implementation("com.microsoft.azure:azure-client-authentication:1.7.14")
implementation("com.nimbusds:nimbus-jose-jwt:9.31")
implementation("com.nimbusds:oauth2-oidc-sdk:10.11") // changes to authorization_details in 10.12+ not supported
implementation("id.walt:waltid-sd-jwt-jvm:1.2306191408.0")
implementation("id.walt:waltid-sd-jwt-jvm:1.2310101347.0")

implementation("org.bouncycastle:bcprov-jdk18on:1.76")
implementation("org.bouncycastle:bcpkix-jdk18on:1.76")
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/id/walt/services/jwt/JwtService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ open class JwtService : WaltIdService(), JWTCryptoProvider {

open fun sign(
keyAlias: String, // verification method
payload: String? = null, type: JOSEObjectType = JOSEObjectType.JWT
): String = implementation.sign(keyAlias, payload)
payload: String? = null, type: String = JOSEObjectType.JWT.type
): String = implementation.sign(keyAlias, payload, type)

override fun sign(payload: JsonObject, keyID: String?): String {
override fun sign(payload: JsonObject, keyID: String?, type: String): String {
if(keyID == null) {
throw Exception("KeyID not provided")
}
return sign(keyID, payload.toString())
return sign(keyID, payload.toString(), type)
}

override fun verify(token: String): JwtVerificationResult = implementation.verify(token)
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/id/walt/services/jwt/WaltIdJwtService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ open class WaltIdJwtService : JwtService() {
override fun sign(
keyAlias: String, // verification method
payload: String?,
type: JOSEObjectType
type: String
): String {

// Default JWT claims
Expand All @@ -96,7 +96,7 @@ open class WaltIdJwtService : JwtService() {
null
}

val serializedSignedJwt = createSignedJWT(issuerKey, keyAlias, claimsSet, includeJwk, type).serialize()
val serializedSignedJwt = createSignedJWT(issuerKey, keyAlias, claimsSet, includeJwk, JOSEObjectType(type)).serialize()
log.debug { "Signed JWT: $serializedSignedJwt" }
return serializedSignedJwt
}
Expand Down

0 comments on commit 38ea68f

Please sign in to comment.