Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Test

on:
push
on: [push, pull_request]

jobs:
unit-test:
Expand Down
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ type Verifier struct {
GenerateKey bool `mapstructure:"generateKey" default:"true"`
// path to the private key for jwt signatures
KeyPath string `mapstructure:"keyPath"`
// expiration time in minutes for JWT tokens
JwtExpiration int `mapstructure:"jwtExpiration" default:"30"`
}

type ClientIdentification struct {
Expand Down
2 changes: 2 additions & 0 deletions config/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func Test_ReadConfig(t *testing.T) {
KeyAlgorithm: "RS256",
GenerateKey: true,
SupportedModes: []string{"urlEncoded"},
JwtExpiration: 30,
},
Logging: Logging{
Level: "DEBUG",
Expand Down Expand Up @@ -117,6 +118,7 @@ func Test_ReadConfig(t *testing.T) {
KeyAlgorithm: "RS256",
GenerateKey: true,
SupportedModes: []string{"urlEncoded"},
JwtExpiration: 30,
},
Logging: Logging{
Level: "INFO",
Expand Down
5 changes: 4 additions & 1 deletion verifier/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ type CredentialVerifier struct {
clientIdentification configModel.ClientIdentification
// config of the verifier
verifierConfig configModel.Verifier
// JWT token expiration time in minutes
jwtExpiration time.Duration
}

// allow singleton access to the verifier
Expand Down Expand Up @@ -351,6 +353,7 @@ func InitVerifier(config *configModel.Configuration) (err error) {
&didSigningKey,
verifierConfig.ClientIdentification,
*verifierConfig,
time.Duration(verifierConfig.JwtExpiration) * time.Minute,
}

logging.Log().Debug("Successfully initalized the verifier")
Expand Down Expand Up @@ -1101,7 +1104,7 @@ func (v *CredentialVerifier) generateAuthenticationRequest(base string, clientId
// generate a jwt, containing the credential and mandatory information as defined by the dsba-convergence
func (v *CredentialVerifier) generateJWT(credentials []map[string]interface{}, holder string, audience string, flatValues bool) (generatedJwt jwt.Token, err error) {

jwtBuilder := jwt.NewBuilder().Issuer(v.GetHost()).Audience([]string{audience}).Expiration(v.clock.Now().Add(time.Minute * 30))
jwtBuilder := jwt.NewBuilder().Issuer(v.GetHost()).Audience([]string{audience}).Expiration(v.clock.Now().Add(v.jwtExpiration))

if holder != "" {
jwtBuilder.Subject(holder)
Expand Down
Loading