Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport v6.0: Rename EmployeeCredential to NutsEmployeeCredential #3700

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
6 changes: 3 additions & 3 deletions auth/api/iam/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (r Wrapper) handleUserLanding(echoCtx echo.Context) error {
accessTokenRequest := redirectSession.AccessTokenRequest
authServerURL := accessTokenRequest.Body.AuthorizationServer

// Make sure there's a user session, loaded with EmployeeCredential
// Make sure there's a user session, loaded with NutsEmployeeCredential
userSession, err := user.GetSession(echoCtx.Request().Context())
if err != nil {
return err
Expand Down Expand Up @@ -176,7 +176,7 @@ func (r Wrapper) issueEmployeeCredential(ctx context.Context, session user.Sessi
expirationDate := session.ExpiresAt
template := vc.VerifiableCredential{
Context: []ssi.URI{credential.NutsV1ContextURI},
Type: []ssi.URI{ssi.MustParseURI("EmployeeCredential")},
Type: []ssi.URI{ssi.MustParseURI("NutsEmployeeCredential")},
Issuer: issuerDID,
IssuanceDate: issuanceDate,
ExpirationDate: &expirationDate,
Expand All @@ -196,7 +196,7 @@ func (r Wrapper) issueEmployeeCredential(ctx context.Context, session user.Sessi
WithStatusListRevocation: false,
})
if err != nil {
return nil, fmt.Errorf("issue EmployeeCredential: %w", err)
return nil, fmt.Errorf("issue NutsEmployeeCredential: %w", err)
}
return employeeCredential, nil
}
6 changes: 3 additions & 3 deletions auth/api/iam/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func TestWrapper_handleUserLanding(t *testing.T) {

err = ctx.client.handleUserLanding(echoCtx)
require.NoError(t, err)
// check for issued EmployeeCredential in session wallet
// check for issued NutsEmployeeCredential in session wallet
require.NoError(t, err)
require.Equal(t, holderSubjectID, userSession.SubjectID)
require.Len(t, userSession.Wallet.Credentials, 1)
Expand All @@ -129,8 +129,8 @@ func TestWrapper_handleUserLanding(t *testing.T) {
require.NoError(t, err)
assert.NotEmpty(t, sessionKey.KeyID)
assert.Equal(t, jwa.EC, sessionKey.KeyType())
// check for details of issued EmployeeCredential
assert.Equal(t, "EmployeeCredential", employeeCredentialTemplate.Type[0].String())
// check for details of issued NutsEmployeeCredential
assert.Equal(t, "NutsEmployeeCredential", employeeCredentialTemplate.Type[0].String())
employeeCredentialSubject := employeeCredentialTemplate.CredentialSubject[0].(map[string]string)
assert.True(t, strings.HasPrefix(employeeCredentialSubject["id"], "did:jwk:"))
assert.Equal(t, userDetails.Id, employeeCredentialSubject["identifier"])
Expand Down
2 changes: 1 addition & 1 deletion auth/client/iam/openid4vp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func TestRelyingParty_RequestRFC021AccessToken(t *testing.T) {
holder.VerifiableCredentialLDContextV1,
credential.NutsV1ContextURI,
},
Type: []ssi.URI{vc.VerifiableCredentialTypeV1URI(), ssi.MustParseURI("EmployeeCredential")},
Type: []ssi.URI{vc.VerifiableCredentialTypeV1URI(), ssi.MustParseURI("NutsEmployeeCredential")},
CredentialSubject: []interface{}{
map[string]interface{}{
"roleName": "employee",
Expand Down
4 changes: 2 additions & 2 deletions docs/_static/auth/v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ components:
"https://www.w3.org/2018/credentials/v1",
"https://nuts.nl/credentials/v1"
],
"type": ["VerifiableCredential", "EmployeeCredential"],
"type": ["VerifiableCredential", "NutsEmployeeCredential"],
"credentialSubject": {
"name": "John Doe",
"roleName": "Janitor",
Expand Down Expand Up @@ -578,7 +578,7 @@ components:
properties:
token:
type: string
example: spnhVHZ4IFVvuNrpflVaB1A7P3A2xZ7G_a8gF_SHMynYSA
example: token=spnhVHZ4IFVvuNrpflVaB1A7P3A2xZ7G_a8gF_SHMynYSA
TokenIntrospectionResponse:
description: Token introspection response as described in RFC7662 section 2.2
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
],
"filter": {
"type": "string",
"const": "EmployeeCredential"
"const": "NutsEmployeeCredential"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/oauth-flow/rfc021/do-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ cat << EOF
"https://www.w3.org/2018/credentials/v1",
"https://nuts.nl/credentials/v1"
],
"type": ["VerifiableCredential", "EmployeeCredential"],
"type": ["VerifiableCredential", "NutsEmployeeCredential"],
"credentialSubject": {
"name": "John Doe",
"roleName": "Janitor",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
],
"filter": {
"type": "string",
"const": "EmployeeCredential"
"const": "NutsEmployeeCredential"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions http/user/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ type Session struct {
Save func() error `json:"-"`
// SubjectID identifies the requesting subject when the user session was created.
// A session needs to be scoped to the subject, since the session gives access to the subject's wallets,
// and the user session might contain session-bound credentials (e.g. EmployeeCredential) that were issued by the subject.
// and the user session might contain session-bound credentials (e.g. NutsEmployeeCredential) that were issued by the subject.
SubjectID string `json:"subjectID"`
Wallet Wallet `json:"wallet"`
ExpiresAt time.Time `json:"expiresAt"`
}

// Wallet is a session-bound Verifiable Credential wallet.
// It's an in-memory wallet which contains the user's private key in plain text.
// This is OK, since the associated credentials are intended for protocol compatibility (OpenID4VP with a low-assurance EmployeeCredential),
// This is OK, since the associated credentials are intended for protocol compatibility (OpenID4VP with a low-assurance NutsEmployeeCredential),
// when an actual user wallet is involved, this wallet isn't used.
type Wallet struct {
Credentials []vc.VerifiableCredential
Expand Down
5 changes: 3 additions & 2 deletions vcr/pe/presentation_definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func TestEmployeeCredential(t *testing.T) {
],
"filter": {
"type": "string",
"const": "EmployeeCredential"
"const": "NutsEmployeeCredential"
}
},
{
Expand Down Expand Up @@ -178,7 +178,8 @@ func TestEmployeeCredential(t *testing.T) {
]
}`))
require.NoError(t, err)
cred, err := vc.ParseVerifiableCredential(`eyJhbGciOiJFUzI1NiIsImtpZCI6ImRpZDp3ZWI6bm9kZUE6aWFtOnJlcXVlc3RlciMwIiwidHlwIjoiSldUIn0.eyJleHAiOjE3MTI1NzI2MTIsImlzcyI6ImRpZDp3ZWI6bm9kZUE6aWFtOnJlcXVlc3RlciIsImp0aSI6ImRpZDp3ZWI6bm9kZUE6aWFtOnJlcXVlc3RlciM4ZjNkMWI0OS1iODYzLTQxZjYtYmY4Ny05ZTVhODY2YWMyMzEiLCJuYmYiOjE3MTI1NjkwMTIsInN1YiI6ImRpZDpqd2s6ZXlKamNuWWlPaUpRTFRJMU5pSXNJbXQwZVNJNklrVkRJaXdpZUNJNklsOVFVVk5TVkY5UmRFWmpOMFpvU0VwUGFGVXRibEJ2TVVaNGRFZDRTRmRqUzJ0b2FqUTVhRE5hT1VVaUxDSjVJam9pTmpoek16TTFOVkJIYm5CcVVVSkVNamRKTjE4NVpFUnpkRzU2TVVwZlZtZzNZVlprUlVOVlNHOXpRU0o5IiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL251dHMubmwvY3JlZGVudGlhbHMvdjEiXSwiY3JlZGVudGlhbFN1YmplY3QiOlt7ImlkIjoiZGlkOmp3azpleUpqY25ZaU9pSlFMVEkxTmlJc0ltdDBlU0k2SWtWRElpd2llQ0k2SWw5UVVWTlNWRjlSZEVaak4wWm9TRXBQYUZVdGJsQnZNVVo0ZEVkNFNGZGpTMnRvYWpRNWFETmFPVVVpTENKNUlqb2lOamh6TXpNMU5WQkhibkJxVVVKRU1qZEpOMTg1WkV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