Skip to content

Commit

Permalink
Extend fromInputDescriptor
Browse files Browse the repository at this point in the history
fix testcases

Fix naming

Unify RequestOptions

Add test file

Enforce CLA

fix CHANGELOG.md

Release/4.1.1 (#105)

* 4.1.1: fix JSON serializer

* rename kmp-crypto references to signum

* easier migration fro renamed serializers
  • Loading branch information
n0900 committed Aug 19, 2024
1 parent c9a1cd4 commit 84c7728
Show file tree
Hide file tree
Showing 24 changed files with 508 additions and 348 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: Verify CLA Acknowledgement
on: [pull_request_target]

jobs:
verify-cla:
uses: a-sit-plus/internal-workflows/.github/workflows/cla.yml@main

3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

Release NEXT:
* Refactor `OidcSiopVerifier.RequestOptions` and `WalletService.RequestOptions` into one separate class `RequestOptions`
* Adds `InputParameter.toRequestOptions()` functionality

Release 4.1.1 (Bugfix Release):
* correctly configure and name JSON serializer:
Expand All @@ -18,7 +20,6 @@ Release 4.1.0:
* `vclib-aries` -> `vck-aries`
* `vclib-openid` -> `vck-openid`
* Rename serializers to avoid ambiguities and kotlin bugs
* `jsonSerializer` -> `vckJsonSerializer`
* `cborSerializer` -> `vckCborSerializer`
* Update Dependencies
* Signum (formerly KMP Crypto): 3.6.0
Expand Down
70 changes: 70 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<div align="center">
<img src="https://github.com/user-attachments/assets/13750466-7d65-492f-9250-420da5467d2d">

# Contributing to A-SIT Plus Open Source

</div>

We are happy to receive external contributions!
"Just" opening issues for encountered problems is greatly appreciated too!

## Reporting Issues

We welcome constructive feedback and enquiries of any kind! Just be sure to check existing issues first to avoid duplicates.
Please try to be as precise as possible and provide a reproducer (where applicable).

## Contributing Changes

We expect the contributor to hold all rights to the contributions they are about to commit.
We particularly condemn copyright infringement and expect contributors to respect this position and strictly observe applicable law!

If you plan on contributing changes to this repository's contents, please

1. Fork it
2. Create a branch with a descriptive name (e.g. `feature/timeTravel` or `fix/gravitationalConstant`)
3. Commit your changes to your branch
4. Open a pull request

We will then review the changes, provide feedback.
Once we agree that the PR is ready, we will approve it, and your PR will be merged.

### Coding Conventions

We try to follow the [official Kotlin coding conventions](https://kotlinlang.org/docs/coding-conventions.html) and expect the same from external contributors.
We don't have any automated checks in place and hence don't strictly enforce convention rules by hard, but we will manually check for obvious violations.
To put it plain and simple:

> When in Rome, do as the Romans do!
### Contributor Licence Agreement

You must sign the [A-SIT Plus Contributor Licence Agreement](https://a-sit-plus.github.io/ASP_CLA.pdf) (CLA) before we can review your PR.
This is a one-time requirement and applies to all A-SIT Plus open-source projects, which indicate to require external contributors to sign the CLA (such as this project).
If you want to know more about what a CLA is and why some legal entities require contributors to sign it, check out the [Wikipedia page about CLAs](https://en.wikipedia.org/wiki/Contributor_License_Agreement).

Please download and fill out the [A-SIT Plus CLA](https://a-sit-plus.github.io/ASP_CLA.pdf).
Either print, sign, and scan it or (preferably) use an eIDAS-compliant qualified electronic signature.
When done, send the signed CLA to [email protected].

Information on the processing of your personal data can be found in the [A-SIT Plus Privacy Policy](https://a-sit-plus.github.io/ASP_Privacy.pdf).
Be sure to carefully read it and only sign the CLA if you accept the terms of this privacy policy! (Don't worry it's a light read!)
You will receive a confirmation message once we have received and processed your CLA.

You are, of course, free to start your work prior to signing the CLA, but the review process can only start after we have received a signed copy of the CLA.
We employ automated checks as part of our CI pipeline to verify external contributors have signed indeed the CLA.
Accordingly, if you do open a PR prior to signing the CLA, the pipeline will fail and a publicly visible message will appear, tagging all contributors who still need to sign the CLA, including instructions on how to proceed.
Once all contributors have signed the CLA, we will re-run the automated CLA checks.
If all checks pass (i.e. all contributors have signed the CLA) we will start reviewing your contributions.

If you have any questions on this matter don't hesitate to contact [email protected]!

<br>

<hr>
<div align="center">

Copyright &copy; 2024 A-SIT Plus GmbH, Seidlgasse 22 / Top 9, 1030 Vienna, Austria

<img src="https://a-sit-plus.github.io/logo_kurzertext.svg" width="163" height="64">

</div>
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,12 @@ as well as a key binding (the JWT is decoded):
}
```

## Contributing
External contributions are greatly appreciated! Be sure to observe the contribution guidelines (see [CONTRIBUTING.md](CONTRIBUTING.md)).
In particular, external contributions to this project are subject to the A-SIT Plus Contributor License Agreement (see also [CONTRIBUTING.md](CONTRIBUTING.md)).



<br>

---
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.stability.nowarn=true
kotlin.native.ignoreDisabledTargets=true

artifactVersion = 4.2.0-SNAPSHOT
artifactVersion = 4.1.1
jdk.version=17


Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import at.asitplus.wallet.lib.jws.DefaultJwsService
import at.asitplus.wallet.lib.jws.DefaultVerifierJwsService
import at.asitplus.wallet.lib.jws.JwsService
import at.asitplus.wallet.lib.jws.VerifierJwsService
import at.asitplus.wallet.lib.oidc.OidcSiopVerifier.AuthnResponseResult
import at.asitplus.wallet.lib.oidc.OpenIdConstants.ClientIdScheme.REDIRECT_URI
import at.asitplus.wallet.lib.oidc.OpenIdConstants.ClientIdScheme.VERIFIER_ATTESTATION
import at.asitplus.wallet.lib.oidc.OpenIdConstants.ClientIdScheme.X509_SAN_DNS
Expand All @@ -38,6 +39,7 @@ import at.asitplus.wallet.lib.oidc.OpenIdConstants.VP_TOKEN
import at.asitplus.wallet.lib.oidvci.decodeFromPostBody
import at.asitplus.wallet.lib.oidvci.decodeFromUrlQuery
import at.asitplus.wallet.lib.oidvci.encodeToParameters
import at.asitplus.wallet.lib.openid.RequestOptions
import com.benasher44.uuid.uuid4
import io.github.aakira.napier.Napier
import io.ktor.http.*
Expand Down Expand Up @@ -307,7 +309,7 @@ class OidcSiopVerifier private constructor(
) = AuthenticationRequestParameters(
responseType = "$ID_TOKEN $VP_TOKEN",
clientId = buildClientId(),
redirectUrl = if (requestOptions.setRedirectUrl()) relyingPartyUrl else null,
redirectUrl = if (requestOptions.includeRedirectUrl()) relyingPartyUrl else null,
responseUrl = responseUrl,
clientIdScheme = clientIdScheme,
scope = requestOptions.buildScope(),
Expand Down Expand Up @@ -497,30 +499,6 @@ class OidcSiopVerifier private constructor(
} else validationResults[0]
}

private fun Verifier.VerifyPresentationResult.mapToAuthnResponseResult(
state: String?,
) = when (this) {
is Verifier.VerifyPresentationResult.InvalidStructure ->
AuthnResponseResult.Error("parse vp failed", state)
.also { Napier.w("VP error: $this") }

is Verifier.VerifyPresentationResult.NotVerified ->
AuthnResponseResult.ValidationError("vpToken", state)
.also { Napier.w("VP error: $this") }

is Verifier.VerifyPresentationResult.Success ->
AuthnResponseResult.Success(vp, state)
.also { Napier.i("VP success: $this") }

is Verifier.VerifyPresentationResult.SuccessIso ->
AuthnResponseResult.SuccessIso(document, state)
.also { Napier.i("VP success: $this") }

is Verifier.VerifyPresentationResult.SuccessSdJwt ->
AuthnResponseResult.SuccessSdJwt(jwsSigned, sdJwt, disclosures, state)
.also { Napier.i("VP success: $this") }
}

private fun verifyMsoMdocResult(
relatedPresentation: JsonElement,
idToken: IdToken,
Expand Down Expand Up @@ -552,14 +530,37 @@ class OidcSiopVerifier private constructor(
}
}

private fun Verifier.VerifyPresentationResult.mapToAuthnResponseResult(
state: String?,
) = when (this) {
is Verifier.VerifyPresentationResult.InvalidStructure ->
AuthnResponseResult.Error("parse vp failed", state)
.also { Napier.w("VP error: $this") }

is Verifier.VerifyPresentationResult.NotVerified ->
AuthnResponseResult.ValidationError("vpToken", state)
.also { Napier.w("VP error: $this") }

is Verifier.VerifyPresentationResult.Success ->
AuthnResponseResult.Success(vp, state)
.also { Napier.i("VP success: $this") }

is Verifier.VerifyPresentationResult.SuccessIso ->
AuthnResponseResult.SuccessIso(document, state)
.also { Napier.i("VP success: $this") }

is Verifier.VerifyPresentationResult.SuccessSdJwt ->
AuthnResponseResult.SuccessSdJwt(jwsSigned, sdJwt, disclosures, state)
.also { Napier.i("VP success: $this") }
}

private val PresentationSubmissionDescriptor.cumulativeJsonPath: String
get() {
var cummulativeJsonPath = this.path
var cumulativeJsonPath = this.path
var descriptorIterator = this.nestedPath
while (descriptorIterator != null) {
cummulativeJsonPath += descriptorIterator.path.substring(1)
cumulativeJsonPath += descriptorIterator.path.substring(1)
descriptorIterator = descriptorIterator.nestedPath
}
return cummulativeJsonPath
return cumulativeJsonPath
}

This file was deleted.

Loading

0 comments on commit 84c7728

Please sign in to comment.