-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29e8a3b
commit 2bd3d18
Showing
14 changed files
with
423 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
gesundheitsid/src/test/java/com/oviva/gesundheitsid/fedclient/api/EntityStatementTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.oviva.gesundheitsid.fedclient.api; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import com.oviva.gesundheitsid.test.ECKeyGenerator; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class EntityStatementTest { | ||
|
||
@Test | ||
void sign_roundTrip() { | ||
|
||
var key = ECKeyGenerator.example(); | ||
|
||
var sub = "hello world!"; | ||
|
||
// when | ||
var jws = EntityStatement.create().sub(sub).build().sign(key); | ||
|
||
// then | ||
var got = EntityStatementJWS.parse(jws.serialize()); | ||
assertEquals(sub, got.body().sub()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 0 additions & 86 deletions
86
oidc-server/src/main/java/com/oviva/gesundheitsid/relyingparty/fed/Config.java
This file was deleted.
Oops, something went wrong.
100 changes: 100 additions & 0 deletions
100
oidc-server/src/main/java/com/oviva/gesundheitsid/relyingparty/fed/FederationConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package com.oviva.gesundheitsid.relyingparty.fed; | ||
|
||
import com.nimbusds.jose.jwk.ECKey; | ||
import com.nimbusds.jose.jwk.JWKSet; | ||
import java.net.URI; | ||
import java.time.Duration; | ||
import java.util.List; | ||
|
||
public record FederationConfig( | ||
URI iss, | ||
URI sub, | ||
URI federationMaster, | ||
JWKSet entitySigningKeys, | ||
|
||
// the actual private key used for singing, _MUST_ be part of `entitySigningKeys` | ||
ECKey entitySigningKey, | ||
JWKSet relyingPartyEncKeys, | ||
Duration ttl, | ||
List<String> redirectUris, | ||
String appName) { | ||
|
||
public static Builder create() { | ||
return new Builder(); | ||
} | ||
|
||
public static final class Builder { | ||
|
||
private URI iss; | ||
private URI sub; | ||
private URI federationMaster; | ||
|
||
private ECKey entitySigningKey; | ||
private JWKSet entitySigningKeys; | ||
|
||
private JWKSet relyingPartyEncKeys; | ||
private Duration ttl; | ||
private List<String> redirectUris; | ||
private String appName; | ||
|
||
public Builder() {} | ||
|
||
public Builder iss(URI iss) { | ||
this.iss = iss; | ||
return this; | ||
} | ||
|
||
public Builder sub(URI sub) { | ||
this.sub = sub; | ||
return this; | ||
} | ||
|
||
public Builder federationMaster(URI federationMaster) { | ||
this.federationMaster = federationMaster; | ||
return this; | ||
} | ||
|
||
public Builder entitySigningKey(ECKey signingKey) { | ||
this.entitySigningKey = signingKey; | ||
return this; | ||
} | ||
|
||
public Builder entitySigningKeys(JWKSet jwks) { | ||
this.entitySigningKeys = jwks; | ||
return this; | ||
} | ||
|
||
public Builder relyingPartyEncKeys(JWKSet jwks) { | ||
this.relyingPartyEncKeys = jwks; | ||
return this; | ||
} | ||
|
||
public Builder ttl(Duration ttl) { | ||
this.ttl = ttl; | ||
return this; | ||
} | ||
|
||
public Builder redirectUris(List<String> redirectUris) { | ||
this.redirectUris = redirectUris; | ||
return this; | ||
} | ||
|
||
public Builder appName(String appName) { | ||
this.appName = appName; | ||
return this; | ||
} | ||
|
||
public FederationConfig build() { | ||
return new FederationConfig( | ||
iss, | ||
sub, | ||
federationMaster, | ||
entitySigningKeys, | ||
entitySigningKey, | ||
relyingPartyEncKeys, | ||
ttl, | ||
redirectUris, | ||
appName); | ||
} | ||
} | ||
} |
Oops, something went wrong.