diff --git a/charts/ssi-credential-issuer/README.md b/charts/ssi-credential-issuer/README.md index fd984e47..5c36c513 100644 --- a/charts/ssi-credential-issuer/README.md +++ b/charts/ssi-credential-issuer/README.md @@ -40,123 +40,123 @@ dependencies: ## Values -| Key | Type | Default | Description | -|-----|------|---------|-------------| -| portalBackendAddress | string | `"https://portal-backend.example.org"` | Provide portal-backend base address. | -| walletAddress | string | `"https://wallet.example.org"` | | -| walletTokenAddress | string | `"https://wallet.example.org/oauth/token"` | | -| service.image.name | string | `"docker.io/tractusx/ssi-credential-issuer-service"` | | -| service.image.tag | string | `""` | | -| service.imagePullPolicy | string | `"IfNotPresent"` | | -| service.resources | object | `{"limits":{"cpu":"45m","memory":"400M"},"requests":{"cpu":"15m","memory":"400M"}}` | We recommend to review the default resource limits as this should a conscious choice. | -| service.logging.businessLogic | string | `"Information"` | | -| service.logging.default | string | `"Information"` | | -| service.healthChecks.startup.path | string | `"/health/startup"` | | -| service.healthChecks.startup.tags[0].name | string | `"HEALTHCHECKS__0__TAGS__1"` | | -| service.healthChecks.startup.tags[0].value | string | `"issuerdb"` | | -| service.healthChecks.liveness.path | string | `"/healthz"` | | -| service.healthChecks.readyness.path | string | `"/ready"` | | -| service.swaggerEnabled | bool | `false` | | -| service.portal.scope | string | `"openid"` | | -| service.portal.grantType | string | `"client_credentials"` | | -| service.portal.clientId | string | `"portal-client-id"` | Provide portal client-id from CX IAM centralidp. | -| service.portal.clientSecret | string | `""` | Client-secret for portal client-id. Secret-key 'portal-client-secret'. | -| service.credential.issuerDid | string | `"did:web:example"` | | -| service.credential.issuerBpn | string | `"BPNL00000001TEST"` | | -| service.credential.statusListUrl | string | `"https://example.org/statuslist"` | | -| service.credential.encryptionConfigIndex | int | `0` | | -| service.credential.encryptionConfigs.index0.index | int | `0` | | -| service.credential.encryptionConfigs.index0.cipherMode | string | `"CBC"` | | -| service.credential.encryptionConfigs.index0.paddingMode | string | `"PKCS7"` | | -| service.credential.encryptionConfigs.index0.encryptionKey | string | `""` | EncryptionKey for wallet. Secret-key 'credential-encryption-key0'. Expected format is 256 bit (64 digits) hex. | -| migrations.name | string | `"migrations"` | | -| migrations.image.name | string | `"docker.io/tractusx/ssi-credential-issuer-migrations"` | | -| migrations.image.tag | string | `""` | | -| migrations.imagePullPolicy | string | `"IfNotPresent"` | | -| migrations.resources | object | `{"limits":{"cpu":"45m","memory":"200M"},"requests":{"cpu":"15m","memory":"200M"}}` | We recommend to review the default resource limits as this should a conscious choice. | -| migrations.seeding.testDataEnvironments | string | `""` | | -| migrations.seeding.testDataPaths | string | `"Seeder/Data"` | | -| migrations.logging.default | string | `"Information"` | | -| migrations.processIdentity.identityId | string | `"ac1cf001-7fbc-1f2f-817f-bce058020006"` | | -| processesworker.name | string | `"processesworker"` | | -| processesworker.image.name | string | `"docker.io/tractusx/ssi-credential-issuer-processes-worker"` | | -| processesworker.image.tag | string | `""` | | -| processesworker.imagePullPolicy | string | `"IfNotPresent"` | | -| processesworker.resources | object | `{"limits":{"cpu":"45m","memory":"200M"},"requests":{"cpu":"15m","memory":"200M"}}` | We recommend to review the default resource limits as this should a conscious choice. | -| processesworker.logging.default | string | `"Information"` | | -| processesworker.portal.scope | string | `"openid"` | | -| processesworker.portal.grantType | string | `"client_credentials"` | | -| processesworker.portal.clientId | string | `"portal-client-id"` | Provide portal client-id from CX IAM centralidp. | -| processesworker.portal.clientSecret | string | `""` | Client-secret for portal client-id. Secret-key 'portal-client-secret'. | -| processesworker.processIdentity.identityId | string | `"ac1cf001-7fbc-1f2f-817f-bce058020006"` | | -| processesworker.wallet.scope | string | `"openid"` | | -| processesworker.wallet.grantType | string | `"client_credentials"` | | -| processesworker.wallet.clientId | string | `"wallet-client-id"` | Provide wallet client-id from CX IAM centralidp. | -| processesworker.wallet.clientSecret | string | `""` | Client-secret for wallet client-id. Secret-key 'wallet-client-secret'. | -| processesworker.wallet.application | string | `"catena-x-portal"` | the application set in the wallet | -| processesworker.wallet.createCredentialPath | string | `"api/v2.0.0/credentials"` | path to create a credential | -| processesworker.wallet.signCredentialPath | string | `"/api/v2.0.0/credentials/{0}"` | path to sign a specific credential; {0} will be replaced by the credential id | -| processesworker.wallet.getCredentialPath | string | `"/api/v2.0.0/credentials/{0}"` | path to get a specific credential; {0} will be replaced by the credential id | -| processesworker.wallet.revokeCredentialPath | string | `"/api/v2.0.0/credentials/{0}"` | path to revoke a specific credential; {0} will be replaced by the credential id | -| credentialExpiry.name | string | `"expiry"` | | -| credentialExpiry.image.name | string | `"docker.io/tractusx/ssi-credential-expiry-app"` | | -| credentialExpiry.image.tag | string | `""` | | -| credentialExpiry.imagePullPolicy | string | `"IfNotPresent"` | | -| credentialExpiry.resources | object | `{"limits":{"cpu":"45m","memory":"105M"},"requests":{"cpu":"15m","memory":"105M"}}` | We recommend to review the default resource limits as this should a conscious choice. | -| credentialExpiry.processIdentity.identityId | string | `"ac1cf001-7fbc-1f2f-817f-bce058020006"` | | -| credentialExpiry.logging.default | string | `"Information"` | | -| credentialExpiry.expiry.expiredVcsToDeleteInMonth | int | `12` | | -| credentialExpiry.expiry.inactiveVcsToDeleteInWeeks | int | `12` | | -| existingSecret | string | `""` | Secret containing the client-secrets for the connection to portal and wallet as well as encryptionKeys for issuer.credential and processesworker.wallet | -| dotnetEnvironment | string | `"Production"` | | -| dbConnection.schema | string | `"issuer"` | | -| dbConnection.sslMode | string | `"Disable"` | | -| postgresql.enabled | bool | `true` | PostgreSQL chart configuration; default configurations: host: "issuer-postgresql-primary", port: 5432; Switch to enable or disable the PostgreSQL helm chart. | -| postgresql.image | object | `{"tag":"15-debian-12"}` | Setting image tag to major to get latest minor updates | -| postgresql.commonLabels."app.kubernetes.io/version" | string | `"15"` | | -| postgresql.auth.username | string | `"issuer"` | Non-root username. | -| postgresql.auth.database | string | `"issuer"` | Database name. | -| postgresql.auth.existingSecret | string | `"{{ .Release.Name }}-issuer-postgres"` | Secret containing the passwords for root usernames postgres and non-root username issuer. Should not be changed without changing the "issuer-postgresSecretName" template as well. | -| postgresql.auth.postgrespassword | string | `""` | Password for the root username 'postgres'. Secret-key 'postgres-password'. | -| postgresql.auth.password | string | `""` | Password for the non-root username 'issuer'. Secret-key 'password'. | -| postgresql.auth.replicationPassword | string | `""` | Password for the non-root username 'repl_user'. Secret-key 'replication-password'. | -| postgresql.architecture | string | `"replication"` | | -| postgresql.audit.pgAuditLog | string | `"write, ddl"` | | -| postgresql.audit.logLinePrefix | string | `"%m %u %d "` | | -| postgresql.primary.extendedConfiguration | string | `""` | Extended PostgreSQL Primary configuration (increase of max_connections recommended - default is 100) | -| postgresql.primary.initdb.scriptsConfigMap | string | `"{{ .Release.Name }}-issuer-cm-postgres"` | | -| postgresql.readReplicas.extendedConfiguration | string | `""` | Extended PostgreSQL read only replicas configuration (increase of max_connections recommended - default is 100) | -| externalDatabase.host | string | `"issuer-postgres-ext"` | External PostgreSQL configuration IMPORTANT: non-root db user needs to be created beforehand on external database. And the init script (02-init-db.sql) available in templates/configmap-postgres-init.yaml needs to be executed beforehand. Database host ('-primary' is added as postfix). | -| externalDatabase.port | int | `5432` | Database port number. | -| externalDatabase.username | string | `"issuer"` | Non-root username for issuer. | -| externalDatabase.database | string | `"issuer"` | Database name. | -| externalDatabase.password | string | `""` | Password for the non-root username (default 'issuer'). Secret-key 'password'. | -| externalDatabase.existingSecret | string | `"issuer-external-db"` | Secret containing the password non-root username, (default 'issuer'). | -| centralidp | object | `{"address":"https://centralidp.example.org","authRealm":"CX-Central","jwtBearerOptions":{"metadataPath":"/auth/realms/CX-Central/.well-known/openid-configuration","refreshInterval":"00:00:30","requireHttpsMetadata":"true","tokenValidationParameters":{"validAudience":"Cl24-CX-SSI-CredentialIssuer","validIssuerPath":"/auth/realms/CX-Central"}},"tokenPath":"/auth/realms/CX-Central/protocol/openid-connect/token","useAuthTrail":true}` | Provide details about centralidp (CX IAM) Keycloak instance. | -| centralidp.address | string | `"https://centralidp.example.org"` | Provide centralidp base address (CX IAM), without trailing '/auth'. | -| centralidp.useAuthTrail | bool | `true` | Flag if the api should be used with an leading /auth path | -| ingress.enabled | bool | `false` | SSI Credential Issuer ingress parameters, enable ingress record generation for ssi-credential-issuer. | -| ingress.tls | list | `[]` | Ingress TLS configuration | -| ingress.hosts[0] | object | `{"host":"","paths":[{"backend":{"port":8080},"path":"/api","pathType":"Prefix"}]}` | Provide default path for the ingress record. | -| portContainer | int | `8080` | | -| portService | int | `8080` | | -| replicaCount | int | `3` | | -| nodeSelector | object | `{}` | Node labels for pod assignment | -| tolerations | list | `[]` | Tolerations for pod assignment | -| affinity.podAntiAffinity | object | `{"preferredDuringSchedulingIgnoredDuringExecution":[{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"DoesNotExist"}]},"topologyKey":"kubernetes.io/hostname"},"weight":100}]}` | Following Catena-X Helm Best Practices, [reference](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity). | -| updateStrategy.type | string | `"RollingUpdate"` | Update strategy type, rolling update configuration parameters, [reference](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies). | -| updateStrategy.rollingUpdate.maxSurge | int | `1` | | -| updateStrategy.rollingUpdate.maxUnavailable | int | `0` | | -| startupProbe | object | `{"failureThreshold":30,"initialDelaySeconds":10,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1}` | Following Catena-X Helm Best Practices, [reference](https://github.com/helm/charts/blob/master/stable/nginx-ingress/values.yaml#L210). | -| livenessProbe.failureThreshold | int | `3` | | -| livenessProbe.initialDelaySeconds | int | `10` | | -| livenessProbe.periodSeconds | int | `10` | | -| livenessProbe.successThreshold | int | `1` | | -| livenessProbe.timeoutSeconds | int | `10` | | -| readinessProbe.failureThreshold | int | `3` | | -| readinessProbe.initialDelaySeconds | int | `10` | | -| readinessProbe.periodSeconds | int | `10` | | -| readinessProbe.successThreshold | int | `1` | | -| readinessProbe.timeoutSeconds | int | `1` | | +| Key | Type | Default | Description | +|-----------------------------------------------------------|------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| portalBackendAddress | string | `"https://portal-backend.example.org"` | Provide portal-backend base address. | +| walletAddress | string | `"https://wallet.example.org"` | | +| walletTokenAddress | string | `"https://wallet.example.org/oauth/token"` | | +| service.image.name | string | `"docker.io/tractusx/ssi-credential-issuer-service"` | | +| service.image.tag | string | `""` | | +| service.imagePullPolicy | string | `"IfNotPresent"` | | +| service.resources | object | `{"limits":{"cpu":"45m","memory":"400M"},"requests":{"cpu":"15m","memory":"400M"}}` | We recommend to review the default resource limits as this should a conscious choice. | +| service.logging.businessLogic | string | `"Information"` | | +| service.logging.default | string | `"Information"` | | +| service.healthChecks.startup.path | string | `"/health/startup"` | | +| service.healthChecks.startup.tags[0].name | string | `"HEALTHCHECKS__0__TAGS__1"` | | +| service.healthChecks.startup.tags[0].value | string | `"issuerdb"` | | +| service.healthChecks.liveness.path | string | `"/healthz"` | | +| service.healthChecks.readyness.path | string | `"/ready"` | | +| service.swaggerEnabled | bool | `false` | | +| service.portal.scope | string | `"openid"` | | +| service.portal.grantType | string | `"client_credentials"` | | +| service.portal.clientId | string | `"portal-client-id"` | Provide portal client-id from CX IAM centralidp. | +| service.portal.clientSecret | string | `""` | Client-secret for portal client-id. Secret-key 'portal-client-secret'. | +| service.credential.issuerDid | string | `"did:web:example"` | | +| service.credential.issuerBpn | string | `"BPNL00000001TEST"` | | +| service.credential.statusListUrl | string | `"https://example.org/statuslist"` | | +| service.credential.encryptionConfigIndex | int | `0` | | +| service.credential.encryptionConfigs.index0.index | int | `0` | | +| service.credential.encryptionConfigs.index0.cipherMode | string | `"CBC"` | | +| service.credential.encryptionConfigs.index0.paddingMode | string | `"PKCS7"` | | +| service.credential.encryptionConfigs.index0.encryptionKey | string | `""` | EncryptionKey for wallet. Secret-key 'credential-encryption-key0'. Expected format is 256 bit (64 digits) hex. | +| migrations.name | string | `"migrations"` | | +| migrations.image.name | string | `"docker.io/tractusx/ssi-credential-issuer-migrations"` | | +| migrations.image.tag | string | `""` | | +| migrations.imagePullPolicy | string | `"IfNotPresent"` | | +| migrations.resources | object | `{"limits":{"cpu":"45m","memory":"200M"},"requests":{"cpu":"15m","memory":"200M"}}` | We recommend to review the default resource limits as this should a conscious choice. | +| migrations.seeding.testDataEnvironments | string | `""` | | +| migrations.seeding.testDataPaths | string | `"Seeder/Data"` | | +| migrations.logging.default | string | `"Information"` | | +| migrations.processIdentity.identityId | string | `"ac1cf001-7fbc-1f2f-817f-bce058020006"` | | +| processesworker.name | string | `"processesworker"` | | +| processesworker.image.name | string | `"docker.io/tractusx/ssi-credential-issuer-processes-worker"` | | +| processesworker.image.tag | string | `""` | | +| processesworker.imagePullPolicy | string | `"IfNotPresent"` | | +| processesworker.resources | object | `{"limits":{"cpu":"45m","memory":"200M"},"requests":{"cpu":"15m","memory":"200M"}}` | We recommend to review the default resource limits as this should a conscious choice. | +| processesworker.logging.default | string | `"Information"` | | +| processesworker.portal.scope | string | `"openid"` | | +| processesworker.portal.grantType | string | `"client_credentials"` | | +| processesworker.portal.clientId | string | `"portal-client-id"` | Provide portal client-id from CX IAM centralidp. | +| processesworker.portal.clientSecret | string | `""` | Client-secret for portal client-id. Secret-key 'portal-client-secret'. | +| processesworker.processIdentity.identityId | string | `"ac1cf001-7fbc-1f2f-817f-bce058020006"` | | +| processesworker.wallet.scope | string | `"openid"` | | +| processesworker.wallet.grantType | string | `"client_credentials"` | | +| processesworker.wallet.clientId | string | `"wallet-client-id"` | Provide wallet client-id from CX IAM centralidp. | +| processesworker.wallet.clientSecret | string | `""` | Client-secret for wallet client-id. Secret-key 'wallet-client-secret'. | +| processesworker.wallet.application | string | `"catena-x-portal"` | the application set in the wallet | +| processesworker.wallet.createSignedCredentialPath | string | `"/api/v2.0.0/credentials"` | path to create a specific credential which is directly signed | +| processesworker.wallet.createCredentialPath | string | `"api/v2.0.0/credentials"` | path to create a credential | +| processesworker.wallet.getCredentialPath | string | `"/api/v2.0.0/credentials/{0}"` | path to get a specific credential; {0} will be replaced by the credential id | +| processesworker.wallet.revokeCredentialPath | string | `"/api/v2.0.0/credentials/{0}"` | path to revoke a specific credential; {0} will be replaced by the credential id | +| credentialExpiry.name | string | `"expiry"` | | +| credentialExpiry.image.name | string | `"docker.io/tractusx/ssi-credential-expiry-app"` | | +| credentialExpiry.image.tag | string | `""` | | +| credentialExpiry.imagePullPolicy | string | `"IfNotPresent"` | | +| credentialExpiry.resources | object | `{"limits":{"cpu":"45m","memory":"105M"},"requests":{"cpu":"15m","memory":"105M"}}` | We recommend to review the default resource limits as this should a conscious choice. | +| credentialExpiry.processIdentity.identityId | string | `"ac1cf001-7fbc-1f2f-817f-bce058020006"` | | +| credentialExpiry.logging.default | string | `"Information"` | | +| credentialExpiry.expiry.expiredVcsToDeleteInMonth | int | `12` | | +| credentialExpiry.expiry.inactiveVcsToDeleteInWeeks | int | `12` | | +| existingSecret | string | `""` | Secret containing the client-secrets for the connection to portal and wallet as well as encryptionKeys for issuer.credential and processesworker.wallet | +| dotnetEnvironment | string | `"Production"` | | +| dbConnection.schema | string | `"issuer"` | | +| dbConnection.sslMode | string | `"Disable"` | | +| postgresql.enabled | bool | `true` | PostgreSQL chart configuration; default configurations: host: "issuer-postgresql-primary", port: 5432; Switch to enable or disable the PostgreSQL helm chart. | +| postgresql.image | object | `{"tag":"15-debian-12"}` | Setting image tag to major to get latest minor updates | +| postgresql.commonLabels."app.kubernetes.io/version" | string | `"15"` | | +| postgresql.auth.username | string | `"issuer"` | Non-root username. | +| postgresql.auth.database | string | `"issuer"` | Database name. | +| postgresql.auth.existingSecret | string | `"{{ .Release.Name }}-issuer-postgres"` | Secret containing the passwords for root usernames postgres and non-root username issuer. Should not be changed without changing the "issuer-postgresSecretName" template as well. | +| postgresql.auth.postgrespassword | string | `""` | Password for the root username 'postgres'. Secret-key 'postgres-password'. | +| postgresql.auth.password | string | `""` | Password for the non-root username 'issuer'. Secret-key 'password'. | +| postgresql.auth.replicationPassword | string | `""` | Password for the non-root username 'repl_user'. Secret-key 'replication-password'. | +| postgresql.architecture | string | `"replication"` | | +| postgresql.audit.pgAuditLog | string | `"write, ddl"` | | +| postgresql.audit.logLinePrefix | string | `"%m %u %d "` | | +| postgresql.primary.extendedConfiguration | string | `""` | Extended PostgreSQL Primary configuration (increase of max_connections recommended - default is 100) | +| postgresql.primary.initdb.scriptsConfigMap | string | `"{{ .Release.Name }}-issuer-cm-postgres"` | | +| postgresql.readReplicas.extendedConfiguration | string | `""` | Extended PostgreSQL read only replicas configuration (increase of max_connections recommended - default is 100) | +| externalDatabase.host | string | `"issuer-postgres-ext"` | External PostgreSQL configuration IMPORTANT: non-root db user needs to be created beforehand on external database. And the init script (02-init-db.sql) available in templates/configmap-postgres-init.yaml needs to be executed beforehand. Database host ('-primary' is added as postfix). | +| externalDatabase.port | int | `5432` | Database port number. | +| externalDatabase.username | string | `"issuer"` | Non-root username for issuer. | +| externalDatabase.database | string | `"issuer"` | Database name. | +| externalDatabase.password | string | `""` | Password for the non-root username (default 'issuer'). Secret-key 'password'. | +| externalDatabase.existingSecret | string | `"issuer-external-db"` | Secret containing the password non-root username, (default 'issuer'). | +| centralidp | object | `{"address":"https://centralidp.example.org","authRealm":"CX-Central","jwtBearerOptions":{"metadataPath":"/auth/realms/CX-Central/.well-known/openid-configuration","refreshInterval":"00:00:30","requireHttpsMetadata":"true","tokenValidationParameters":{"validAudience":"Cl24-CX-SSI-CredentialIssuer","validIssuerPath":"/auth/realms/CX-Central"}},"tokenPath":"/auth/realms/CX-Central/protocol/openid-connect/token","useAuthTrail":true}` | Provide details about centralidp (CX IAM) Keycloak instance. | +| centralidp.address | string | `"https://centralidp.example.org"` | Provide centralidp base address (CX IAM), without trailing '/auth'. | +| centralidp.useAuthTrail | bool | `true` | Flag if the api should be used with an leading /auth path | +| ingress.enabled | bool | `false` | SSI Credential Issuer ingress parameters, enable ingress record generation for ssi-credential-issuer. | +| ingress.tls | list | `[]` | Ingress TLS configuration | +| ingress.hosts[0] | object | `{"host":"","paths":[{"backend":{"port":8080},"path":"/api","pathType":"Prefix"}]}` | Provide default path for the ingress record. | +| portContainer | int | `8080` | | +| portService | int | `8080` | | +| replicaCount | int | `3` | | +| nodeSelector | object | `{}` | Node labels for pod assignment | +| tolerations | list | `[]` | Tolerations for pod assignment | +| affinity.podAntiAffinity | object | `{"preferredDuringSchedulingIgnoredDuringExecution":[{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"DoesNotExist"}]},"topologyKey":"kubernetes.io/hostname"},"weight":100}]}` | Following Catena-X Helm Best Practices, [reference](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity). | +| updateStrategy.type | string | `"RollingUpdate"` | Update strategy type, rolling update configuration parameters, [reference](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies). | +| updateStrategy.rollingUpdate.maxSurge | int | `1` | | +| updateStrategy.rollingUpdate.maxUnavailable | int | `0` | | +| startupProbe | object | `{"failureThreshold":30,"initialDelaySeconds":10,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1}` | Following Catena-X Helm Best Practices, [reference](https://github.com/helm/charts/blob/master/stable/nginx-ingress/values.yaml#L210). | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `10` | | +| livenessProbe.periodSeconds | int | `10` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `10` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `10` | | +| readinessProbe.periodSeconds | int | `10` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | Autogenerated with [helm docs](https://github.com/norwoodj/helm-docs) diff --git a/charts/ssi-credential-issuer/templates/cronjob-issuer-processes.yaml b/charts/ssi-credential-issuer/templates/cronjob-issuer-processes.yaml index 5cd85504..55a134ab 100644 --- a/charts/ssi-credential-issuer/templates/cronjob-issuer-processes.yaml +++ b/charts/ssi-credential-issuer/templates/cronjob-issuer-processes.yaml @@ -138,10 +138,10 @@ spec: key: "credential-encryption-key0" - name: "WALLET__WALLETAPPLICATION" value: "{{ .Values.processesworker.wallet.application }}" + - name: "WALLET__CREATESIGNEDCREDENTIALPATH" + value: "{{ .Values.processesworker.wallet.createSignedCredentialPath }}" - name: "WALLET__CREATECREDENTIALPATH" value: "{{ .Values.processesworker.wallet.createCredentialPath }}" - - name: "WALLET__SIGNCREDENTIALPATH" - value: "{{ .Values.processesworker.wallet.signCredentialPath }}" - name: "WALLET__GETCREDENTIALPATH" value: "{{ .Values.processesworker.wallet.getCredentialPath }}" - name: "WALLET__REVOKECREDENTIALPATH" diff --git a/charts/ssi-credential-issuer/templates/deployment-issuer-service.yaml b/charts/ssi-credential-issuer/templates/deployment-issuer-service.yaml index 9631a3a4..b2b3381b 100644 --- a/charts/ssi-credential-issuer/templates/deployment-issuer-service.yaml +++ b/charts/ssi-credential-issuer/templates/deployment-issuer-service.yaml @@ -165,10 +165,10 @@ spec: key: "credential-encryption-key0" - name: "WALLET__WALLETAPPLICATION" value: "{{ .Values.processesworker.wallet.application }}" + - name: "WALLET__CREATESIGNEDCREDENTIALPATH" + value: "{{ .Values.processesworker.wallet.createSignedCredentialPath }}" - name: "WALLET__CREATECREDENTIALPATH" value: "{{ .Values.processesworker.wallet.createCredentialPath }}" - - name: "WALLET__SIGNCREDENTIALPATH" - value: "{{ .Values.processesworker.wallet.signCredentialPath }}" - name: "WALLET__GETCREDENTIALPATH" value: "{{ .Values.processesworker.wallet.getCredentialPath }}" - name: "WALLET__REVOKECREDENTIALPATH" diff --git a/charts/ssi-credential-issuer/values.yaml b/charts/ssi-credential-issuer/values.yaml index ed139024..50b55548 100644 --- a/charts/ssi-credential-issuer/values.yaml +++ b/charts/ssi-credential-issuer/values.yaml @@ -128,8 +128,8 @@ processesworker: application: "catena-x-portal" # -- path to create a credential createCredentialPath: "api/v2.0.0/credentials" - # -- path to sign a specific credential; {0} will be replaced by the credential id - signCredentialPath: "/api/v2.0.0/credentials/{0}" + # -- path to create a specific credential which is directly signed + createSignedCredentialPath: "/api/v2.0.0/credentials" # -- path to get a specific credential; {0} will be replaced by the credential id getCredentialPath: "/api/v2.0.0/credentials/{0}" # -- path to revoke a specific credential; {0} will be replaced by the credential id diff --git a/src/database/SsiCredentialIssuer.Entities/Enums/ProcessStepTypeId.cs b/src/database/SsiCredentialIssuer.Entities/Enums/ProcessStepTypeId.cs index e870cf07..65cd8de4 100644 --- a/src/database/SsiCredentialIssuer.Entities/Enums/ProcessStepTypeId.cs +++ b/src/database/SsiCredentialIssuer.Entities/Enums/ProcessStepTypeId.cs @@ -22,8 +22,7 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Enums; public enum ProcessStepTypeId { // CREATE CREDENTIAL PROCESS - CREATE_CREDENTIAL = 1, - SIGN_CREDENTIAL = 2, + CREATE_SIGNED_CREDENTIAL = 1, SAVE_CREDENTIAL_DOCUMENT = 3, CREATE_CREDENTIAL_FOR_HOLDER = 4, TRIGGER_CALLBACK = 5, diff --git a/src/database/SsiCredentialIssuer.Migrations/Migrations/20240814122258_232-MergeCreateAndSignProcessStep.Designer.cs b/src/database/SsiCredentialIssuer.Migrations/Migrations/20240814122258_232-MergeCreateAndSignProcessStep.Designer.cs new file mode 100644 index 00000000..6213cf4e --- /dev/null +++ b/src/database/SsiCredentialIssuer.Migrations/Migrations/20240814122258_232-MergeCreateAndSignProcessStep.Designer.cs @@ -0,0 +1,1655 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +// +using System; +using System.Text.Json; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Org.Eclipse.TractusX.SsiCredentialIssuer.Entities; + +#nullable disable + +namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Migrations.Migrations +{ + [DbContext(typeof(IssuerDbContext))] + [Migration("20240814122258_232-MergeCreateAndSignProcessStep")] + partial class _232MergeCreateAndSignProcessStep + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("issuer") + .UseCollation("en_US.utf8") + .HasAnnotation("ProductVersion", "8.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.AuditEntities.AuditCompanySsiDetail20240228", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("Bpnl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("bpnl"); + + b.Property("CompanySsiDetailStatusId") + .HasColumnType("integer") + .HasColumnName("company_ssi_detail_status_id"); + + b.Property("CreatorUserId") + .HasColumnType("uuid") + .HasColumnName("creator_user_id"); + + b.Property("Credential") + .HasColumnType("text") + .HasColumnName("credential"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("ExpiryCheckTypeId") + .HasColumnType("integer") + .HasColumnName("expiry_check_type_id"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry_date"); + + b.Property("ExternalCredentialId") + .HasColumnType("uuid") + .HasColumnName("external_credential_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("IssuerBpn") + .IsRequired() + .HasColumnType("text") + .HasColumnName("issuer_bpn"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("VerifiedCredentialExternalTypeDetailVersionId") + .HasColumnType("uuid") + .HasColumnName("verified_credential_external_type_detail_version_id"); + + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_company_ssi_detail20240228"); + + b.ToTable("audit_company_ssi_detail20240228", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.AuditEntities.AuditCompanySsiDetail20240419", b => + { + b.Property("AuditV2Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v2id"); + + b.Property("AuditV2DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v2date_last_changed"); + + b.Property("AuditV2LastEditorId") + .HasColumnType("text") + .HasColumnName("audit_v2last_editor_id"); + + b.Property("AuditV2OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v2operation_id"); + + b.Property("Bpnl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("bpnl"); + + b.Property("CompanySsiDetailStatusId") + .HasColumnType("integer") + .HasColumnName("company_ssi_detail_status_id"); + + b.Property("CreatorUserId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("creator_user_id"); + + b.Property("Credential") + .HasColumnType("text") + .HasColumnName("credential"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("ExpiryCheckTypeId") + .HasColumnType("integer") + .HasColumnName("expiry_check_type_id"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry_date"); + + b.Property("ExternalCredentialId") + .HasColumnType("uuid") + .HasColumnName("external_credential_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("IssuerBpn") + .IsRequired() + .HasColumnType("text") + .HasColumnName("issuer_bpn"); + + b.Property("LastEditorId") + .HasColumnType("text") + .HasColumnName("last_editor_id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("VerifiedCredentialExternalTypeDetailVersionId") + .HasColumnType("uuid") + .HasColumnName("verified_credential_external_type_detail_version_id"); + + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.HasKey("AuditV2Id") + .HasName("pk_audit_company_ssi_detail20240419"); + + b.ToTable("audit_company_ssi_detail20240419", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.AuditEntities.AuditDocument20240305", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DocumentContent") + .HasColumnType("bytea") + .HasColumnName("document_content"); + + b.Property("DocumentHash") + .HasColumnType("bytea") + .HasColumnName("document_hash"); + + b.Property("DocumentName") + .HasColumnType("text") + .HasColumnName("document_name"); + + b.Property("DocumentStatusId") + .HasColumnType("integer") + .HasColumnName("document_status_id"); + + b.Property("DocumentTypeId") + .HasColumnType("integer") + .HasColumnName("document_type_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("MediaTypeId") + .HasColumnType("integer") + .HasColumnName("media_type_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_document20240305"); + + b.ToTable("audit_document20240305", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.AuditEntities.AuditDocument20240419", b => + { + b.Property("AuditV2Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v2id"); + + b.Property("AuditV2DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v2date_last_changed"); + + b.Property("AuditV2LastEditorId") + .HasColumnType("text") + .HasColumnName("audit_v2last_editor_id"); + + b.Property("AuditV2OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v2operation_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DocumentContent") + .HasColumnType("bytea") + .HasColumnName("document_content"); + + b.Property("DocumentHash") + .HasColumnType("bytea") + .HasColumnName("document_hash"); + + b.Property("DocumentName") + .HasColumnType("text") + .HasColumnName("document_name"); + + b.Property("DocumentStatusId") + .HasColumnType("integer") + .HasColumnName("document_status_id"); + + b.Property("DocumentTypeId") + .HasColumnType("integer") + .HasColumnName("document_type_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("IdentityId") + .HasColumnType("text") + .HasColumnName("identity_id"); + + b.Property("LastEditorId") + .HasColumnType("text") + .HasColumnName("last_editor_id"); + + b.Property("MediaTypeId") + .HasColumnType("integer") + .HasColumnName("media_type_id"); + + b.HasKey("AuditV2Id") + .HasName("pk_audit_document20240419"); + + b.ToTable("audit_document20240419", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiDetail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Bpnl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("bpnl"); + + b.Property("CompanySsiDetailStatusId") + .HasColumnType("integer") + .HasColumnName("company_ssi_detail_status_id"); + + b.Property("CreatorUserId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("creator_user_id"); + + b.Property("Credential") + .HasColumnType("text") + .HasColumnName("credential"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("ExpiryCheckTypeId") + .HasColumnType("integer") + .HasColumnName("expiry_check_type_id"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry_date"); + + b.Property("ExternalCredentialId") + .HasColumnType("uuid") + .HasColumnName("external_credential_id"); + + b.Property("IssuerBpn") + .IsRequired() + .HasColumnType("text") + .HasColumnName("issuer_bpn"); + + b.Property("LastEditorId") + .HasColumnType("text") + .HasColumnName("last_editor_id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("VerifiedCredentialExternalTypeDetailVersionId") + .HasColumnType("uuid") + .HasColumnName("verified_credential_external_type_detail_version_id"); + + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.HasKey("Id") + .HasName("pk_company_ssi_details"); + + b.HasIndex("CompanySsiDetailStatusId") + .HasDatabaseName("ix_company_ssi_details_company_ssi_detail_status_id"); + + b.HasIndex("ExpiryCheckTypeId") + .HasDatabaseName("ix_company_ssi_details_expiry_check_type_id"); + + b.HasIndex("ProcessId") + .HasDatabaseName("ix_company_ssi_details_process_id"); + + b.HasIndex("VerifiedCredentialExternalTypeDetailVersionId") + .HasDatabaseName("ix_company_ssi_details_verified_credential_external_type_detai"); + + b.HasIndex("VerifiedCredentialTypeId") + .HasDatabaseName("ix_company_ssi_details_verified_credential_type_id"); + + b.ToTable("company_ssi_details", "issuer", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL", "CREATE FUNCTION \"issuer\".\"LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL$\r\nBEGIN\r\n INSERT INTO \"issuer\".\"audit_company_ssi_detail20240419\" (\"id\", \"bpnl\", \"issuer_bpn\", \"verified_credential_type_id\", \"company_ssi_detail_status_id\", \"date_created\", \"creator_user_id\", \"expiry_date\", \"verified_credential_external_type_detail_version_id\", \"expiry_check_type_id\", \"process_id\", \"external_credential_id\", \"credential\", \"date_last_changed\", \"last_editor_id\", \"audit_v2id\", \"audit_v2operation_id\", \"audit_v2date_last_changed\", \"audit_v2last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"bpnl\", \r\n NEW.\"issuer_bpn\", \r\n NEW.\"verified_credential_type_id\", \r\n NEW.\"company_ssi_detail_status_id\", \r\n NEW.\"date_created\", \r\n NEW.\"creator_user_id\", \r\n NEW.\"expiry_date\", \r\n NEW.\"verified_credential_external_type_detail_version_id\", \r\n NEW.\"expiry_check_type_id\", \r\n NEW.\"process_id\", \r\n NEW.\"external_credential_id\", \r\n NEW.\"credential\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL AFTER INSERT\r\nON \"issuer\".\"company_ssi_details\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"issuer\".\"LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL", "CREATE FUNCTION \"issuer\".\"LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL$\r\nBEGIN\r\n INSERT INTO \"issuer\".\"audit_company_ssi_detail20240419\" (\"id\", \"bpnl\", \"issuer_bpn\", \"verified_credential_type_id\", \"company_ssi_detail_status_id\", \"date_created\", \"creator_user_id\", \"expiry_date\", \"verified_credential_external_type_detail_version_id\", \"expiry_check_type_id\", \"process_id\", \"external_credential_id\", \"credential\", \"date_last_changed\", \"last_editor_id\", \"audit_v2id\", \"audit_v2operation_id\", \"audit_v2date_last_changed\", \"audit_v2last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"bpnl\", \r\n NEW.\"issuer_bpn\", \r\n NEW.\"verified_credential_type_id\", \r\n NEW.\"company_ssi_detail_status_id\", \r\n NEW.\"date_created\", \r\n NEW.\"creator_user_id\", \r\n NEW.\"expiry_date\", \r\n NEW.\"verified_credential_external_type_detail_version_id\", \r\n NEW.\"expiry_check_type_id\", \r\n NEW.\"process_id\", \r\n NEW.\"external_credential_id\", \r\n NEW.\"credential\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL AFTER UPDATE\r\nON \"issuer\".\"company_ssi_details\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"issuer\".\"LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiDetailAssignedDocument", b => + { + b.Property("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.Property("CompanySsiDetailId") + .HasColumnType("uuid") + .HasColumnName("company_ssi_detail_id"); + + b.HasKey("DocumentId", "CompanySsiDetailId") + .HasName("pk_company_ssi_detail_assigned_documents"); + + b.HasIndex("CompanySsiDetailId") + .HasDatabaseName("ix_company_ssi_detail_assigned_documents_company_ssi_detail_id"); + + b.ToTable("company_ssi_detail_assigned_documents", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiDetailStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_company_ssi_detail_statuses"); + + b.ToTable("company_ssi_detail_statuses", "issuer"); + + b.HasData( + new + { + Id = 1, + Label = "PENDING" + }, + new + { + Id = 2, + Label = "ACTIVE" + }, + new + { + Id = 3, + Label = "REVOKED" + }, + new + { + Id = 4, + Label = "INACTIVE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiProcessData", b => + { + b.Property("CompanySsiDetailId") + .HasColumnType("uuid") + .HasColumnName("company_ssi_detail_id"); + + b.Property("CallbackUrl") + .HasColumnType("text") + .HasColumnName("callback_url"); + + b.Property("ClientId") + .HasColumnType("text") + .HasColumnName("client_id"); + + b.Property("ClientSecret") + .HasColumnType("bytea") + .HasColumnName("client_secret"); + + b.Property("CredentialTypeKindId") + .HasColumnType("integer") + .HasColumnName("credential_type_kind_id"); + + b.Property("EncryptionMode") + .HasColumnType("integer") + .HasColumnName("encryption_mode"); + + b.Property("HolderWalletUrl") + .HasColumnType("text") + .HasColumnName("holder_wallet_url"); + + b.Property("InitializationVector") + .HasColumnType("bytea") + .HasColumnName("initialization_vector"); + + b.Property("Schema") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("schema"); + + b.HasKey("CompanySsiDetailId") + .HasName("pk_company_ssi_process_data"); + + b.HasIndex("CredentialTypeKindId") + .HasDatabaseName("ix_company_ssi_process_data_credential_type_kind_id"); + + b.ToTable("company_ssi_process_data", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DocumentContent") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("document_content"); + + b.Property("DocumentHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("document_hash"); + + b.Property("DocumentName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("document_name"); + + b.Property("DocumentStatusId") + .HasColumnType("integer") + .HasColumnName("document_status_id"); + + b.Property("DocumentTypeId") + .HasColumnType("integer") + .HasColumnName("document_type_id"); + + b.Property("IdentityId") + .HasColumnType("text") + .HasColumnName("identity_id"); + + b.Property("LastEditorId") + .HasColumnType("text") + .HasColumnName("last_editor_id"); + + b.Property("MediaTypeId") + .HasColumnType("integer") + .HasColumnName("media_type_id"); + + b.HasKey("Id") + .HasName("pk_documents"); + + b.HasIndex("DocumentStatusId") + .HasDatabaseName("ix_documents_document_status_id"); + + b.HasIndex("DocumentTypeId") + .HasDatabaseName("ix_documents_document_type_id"); + + b.HasIndex("MediaTypeId") + .HasDatabaseName("ix_documents_media_type_id"); + + b.ToTable("documents", "issuer", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_DOCUMENT"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_DOCUMENT"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_DOCUMENT", "CREATE FUNCTION \"issuer\".\"LC_TRIGGER_AFTER_INSERT_DOCUMENT\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_DOCUMENT$\r\nBEGIN\r\n INSERT INTO \"issuer\".\"audit_document20240419\" (\"id\", \"date_created\", \"document_hash\", \"document_content\", \"document_name\", \"media_type_id\", \"document_type_id\", \"document_status_id\", \"identity_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v2id\", \"audit_v2operation_id\", \"audit_v2date_last_changed\", \"audit_v2last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"document_hash\", \r\n NEW.\"document_content\", \r\n NEW.\"document_name\", \r\n NEW.\"media_type_id\", \r\n NEW.\"document_type_id\", \r\n NEW.\"document_status_id\", \r\n NEW.\"identity_id\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_DOCUMENT$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_DOCUMENT AFTER INSERT\r\nON \"issuer\".\"documents\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"issuer\".\"LC_TRIGGER_AFTER_INSERT_DOCUMENT\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_DOCUMENT", "CREATE FUNCTION \"issuer\".\"LC_TRIGGER_AFTER_UPDATE_DOCUMENT\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_DOCUMENT$\r\nBEGIN\r\n INSERT INTO \"issuer\".\"audit_document20240419\" (\"id\", \"date_created\", \"document_hash\", \"document_content\", \"document_name\", \"media_type_id\", \"document_type_id\", \"document_status_id\", \"identity_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v2id\", \"audit_v2operation_id\", \"audit_v2date_last_changed\", \"audit_v2last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"document_hash\", \r\n NEW.\"document_content\", \r\n NEW.\"document_name\", \r\n NEW.\"media_type_id\", \r\n NEW.\"document_type_id\", \r\n NEW.\"document_status_id\", \r\n NEW.\"identity_id\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_DOCUMENT$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_DOCUMENT AFTER UPDATE\r\nON \"issuer\".\"documents\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"issuer\".\"LC_TRIGGER_AFTER_UPDATE_DOCUMENT\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.DocumentStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_document_status"); + + b.ToTable("document_status", "issuer"); + + b.HasData( + new + { + Id = 2, + Label = "ACTIVE" + }, + new + { + Id = 3, + Label = "INACTIVE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.DocumentType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_document_types"); + + b.ToTable("document_types", "issuer"); + + b.HasData( + new + { + Id = 1, + Label = "PRESENTATION" + }, + new + { + Id = 2, + Label = "CREDENTIAL" + }, + new + { + Id = 3, + Label = "VERIFIED_CREDENTIAL" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ExpiryCheckType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_expiry_check_types"); + + b.ToTable("expiry_check_types", "issuer"); + + b.HasData( + new + { + Id = 1, + Label = "ONE_MONTH" + }, + new + { + Id = 2, + Label = "TWO_WEEKS" + }, + new + { + Id = 3, + Label = "ONE_DAY" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.MediaType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_media_types"); + + b.ToTable("media_types", "issuer"); + + b.HasData( + new + { + Id = 1, + Label = "JPEG" + }, + new + { + Id = 2, + Label = "GIF" + }, + new + { + Id = 3, + Label = "PNG" + }, + new + { + Id = 4, + Label = "SVG" + }, + new + { + Id = 5, + Label = "TIFF" + }, + new + { + Id = 6, + Label = "PDF" + }, + new + { + Id = 7, + Label = "JSON" + }, + new + { + Id = 8, + Label = "PEM" + }, + new + { + Id = 9, + Label = "CA_CERT" + }, + new + { + Id = 10, + Label = "PKX_CER" + }, + new + { + Id = 11, + Label = "OCTET" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.Process", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LockExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("lock_expiry_date"); + + b.Property("ProcessTypeId") + .HasColumnType("integer") + .HasColumnName("process_type_id"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("uuid") + .HasColumnName("version"); + + b.HasKey("Id") + .HasName("pk_processes"); + + b.HasIndex("ProcessTypeId") + .HasDatabaseName("ix_processes_process_type_id"); + + b.ToTable("processes", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ProcessStep", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Message") + .HasColumnType("text") + .HasColumnName("message"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("ProcessStepStatusId") + .HasColumnType("integer") + .HasColumnName("process_step_status_id"); + + b.Property("ProcessStepTypeId") + .HasColumnType("integer") + .HasColumnName("process_step_type_id"); + + b.HasKey("Id") + .HasName("pk_process_steps"); + + b.HasIndex("ProcessId") + .HasDatabaseName("ix_process_steps_process_id"); + + b.HasIndex("ProcessStepStatusId") + .HasDatabaseName("ix_process_steps_process_step_status_id"); + + b.HasIndex("ProcessStepTypeId") + .HasDatabaseName("ix_process_steps_process_step_type_id"); + + b.ToTable("process_steps", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ProcessStepStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_process_step_statuses"); + + b.ToTable("process_step_statuses", "issuer"); + + b.HasData( + new + { + Id = 1, + Label = "TODO" + }, + new + { + Id = 2, + Label = "DONE" + }, + new + { + Id = 3, + Label = "SKIPPED" + }, + new + { + Id = 4, + Label = "FAILED" + }, + new + { + Id = 5, + Label = "DUPLICATE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ProcessStepType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_process_step_types"); + + b.ToTable("process_step_types", "issuer"); + + b.HasData( + new + { + Id = 1, + Label = "CREATE_SIGNED_CREDENTIAL" + }, + new + { + Id = 3, + Label = "SAVE_CREDENTIAL_DOCUMENT" + }, + new + { + Id = 4, + Label = "CREATE_CREDENTIAL_FOR_HOLDER" + }, + new + { + Id = 5, + Label = "TRIGGER_CALLBACK" + }, + new + { + Id = 100, + Label = "REVOKE_CREDENTIAL" + }, + new + { + Id = 101, + Label = "TRIGGER_NOTIFICATION" + }, + new + { + Id = 102, + Label = "TRIGGER_MAIL" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ProcessType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_process_types"); + + b.ToTable("process_types", "issuer"); + + b.HasData( + new + { + Id = 1, + Label = "CREATE_CREDENTIAL" + }, + new + { + Id = 2, + Label = "DECLINE_CREDENTIAL" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.UseCase", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("Shortname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("shortname"); + + b.HasKey("Id") + .HasName("pk_use_cases"); + + b.ToTable("use_cases", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialExternalType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasColumnType("text") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_verified_credential_external_types"); + + b.ToTable("verified_credential_external_types", "issuer"); + + b.HasData( + new + { + Id = 1, + Label = "TRACEABILITY_CREDENTIAL" + }, + new + { + Id = 2, + Label = "PCF_CREDENTIAL" + }, + new + { + Id = 3, + Label = "BEHAVIOR_TWIN_CREDENTIAL" + }, + new + { + Id = 4, + Label = "MEMBERSHIP_CREDENTIAL" + }, + new + { + Id = 5, + Label = "CIRCULAR_ECONOMY" + }, + new + { + Id = 6, + Label = "QUALITY_CREDENTIAL" + }, + new + { + Id = 7, + Label = "BUSINESS_PARTNER_NUMBER" + }, + new + { + Id = 8, + Label = "DEMAND_AND_CAPACITY_MANAGEMENT" + }, + new + { + Id = 9, + Label = "DEMAND_AND_CAPACITY_MANAGEMENT_PURIS" + }, + new + { + Id = 10, + Label = "BUSINESS_PARTNER_DATA_MANAGEMENT" + }, + new + { + Id = 11, + Label = "FRAMEWORK_AGREEMENT" + }, + new + { + Id = 12, + Label = "DATA_EXCHANGE_GOVERNANCE_CREDENTIAL" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialExternalTypeDetailVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Expiry") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry"); + + b.Property("Template") + .HasColumnType("text") + .HasColumnName("template"); + + b.Property("ValidFrom") + .HasColumnType("timestamp with time zone") + .HasColumnName("valid_from"); + + b.Property("VerifiedCredentialExternalTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_external_type_id"); + + b.Property("Version") + .HasColumnType("text") + .HasColumnName("version"); + + b.HasKey("Id") + .HasName("pk_verified_credential_external_type_detail_versions"); + + b.HasIndex("VerifiedCredentialExternalTypeId", "Version") + .IsUnique() + .HasDatabaseName("ix_verified_credential_external_type_detail_versions_verified_"); + + b.ToTable("verified_credential_external_type_detail_versions", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_verified_credential_types"); + + b.ToTable("verified_credential_types", "issuer"); + + b.HasData( + new + { + Id = 1, + Label = "TRACEABILITY_FRAMEWORK" + }, + new + { + Id = 2, + Label = "PCF_FRAMEWORK" + }, + new + { + Id = 3, + Label = "BEHAVIOR_TWIN_FRAMEWORK" + }, + new + { + Id = 4, + Label = "MEMBERSHIP" + }, + new + { + Id = 5, + Label = "CIRCULAR_ECONOMY" + }, + new + { + Id = 6, + Label = "FRAMEWORK_AGREEMENT_QUALITY" + }, + new + { + Id = 7, + Label = "BUSINESS_PARTNER_NUMBER" + }, + new + { + Id = 8, + Label = "DEMAND_AND_CAPACITY_MANAGEMENT" + }, + new + { + Id = 9, + Label = "DEMAND_AND_CAPACITY_MANAGEMENT_PURIS" + }, + new + { + Id = 10, + Label = "BUSINESS_PARTNER_DATA_MANAGEMENT" + }, + new + { + Id = 11, + Label = "FRAMEWORK_AGREEMENT" + }, + new + { + Id = 12, + Label = "DATA_EXCHANGE_GOVERNANCE_CREDENTIAL" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeAssignedExternalType", b => + { + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.Property("VerifiedCredentialExternalTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_external_type_id"); + + b.HasKey("VerifiedCredentialTypeId", "VerifiedCredentialExternalTypeId") + .HasName("pk_verified_credential_type_assigned_external_types"); + + b.HasIndex("VerifiedCredentialExternalTypeId") + .HasDatabaseName("ix_verified_credential_type_assigned_external_types_verified_c"); + + b.HasIndex("VerifiedCredentialTypeId") + .IsUnique() + .HasDatabaseName("ix_verified_credential_type_assigned_external_types_verified_c1"); + + b.ToTable("verified_credential_type_assigned_external_types", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeAssignedKind", b => + { + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.Property("VerifiedCredentialTypeKindId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_kind_id"); + + b.HasKey("VerifiedCredentialTypeId", "VerifiedCredentialTypeKindId") + .HasName("pk_verified_credential_type_assigned_kinds"); + + b.HasIndex("VerifiedCredentialTypeId") + .HasDatabaseName("ix_verified_credential_type_assigned_kinds_verified_credential"); + + b.HasIndex("VerifiedCredentialTypeKindId") + .HasDatabaseName("ix_verified_credential_type_assigned_kinds_verified_credential1"); + + b.ToTable("verified_credential_type_assigned_kinds", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeAssignedUseCase", b => + { + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.Property("UseCaseId") + .HasColumnType("uuid") + .HasColumnName("use_case_id"); + + b.HasKey("VerifiedCredentialTypeId", "UseCaseId") + .HasName("pk_verified_credential_type_assigned_use_cases"); + + b.HasIndex("UseCaseId") + .IsUnique() + .HasDatabaseName("ix_verified_credential_type_assigned_use_cases_use_case_id"); + + b.HasIndex("VerifiedCredentialTypeId") + .IsUnique() + .HasDatabaseName("ix_verified_credential_type_assigned_use_cases_verified_creden"); + + b.ToTable("verified_credential_type_assigned_use_cases", "issuer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeKind", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_verified_credential_type_kinds"); + + b.ToTable("verified_credential_type_kinds", "issuer"); + + b.HasData( + new + { + Id = 1, + Label = "FRAMEWORK" + }, + new + { + Id = 2, + Label = "MEMBERSHIP" + }, + new + { + Id = 3, + Label = "BPN" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiDetail", b => + { + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiDetailStatus", "CompanySsiDetailStatus") + .WithMany("CompanySsiDetails") + .HasForeignKey("CompanySsiDetailStatusId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_company_ssi_detail_statuses_company_ssi"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ExpiryCheckType", "ExpiryCheckType") + .WithMany("CompanySsiDetails") + .HasForeignKey("ExpiryCheckTypeId") + .HasConstraintName("fk_company_ssi_details_expiry_check_types_expiry_check_type_id"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.Process", "Process") + .WithMany("CompanySsiDetails") + .HasForeignKey("ProcessId") + .HasConstraintName("fk_company_ssi_details_processes_process_id"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialExternalTypeDetailVersion", "VerifiedCredentialExternalTypeDetailVersion") + .WithMany("CompanySsiDetails") + .HasForeignKey("VerifiedCredentialExternalTypeDetailVersionId") + .HasConstraintName("fk_company_ssi_details_verified_credential_external_type_detai"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithMany("CompanySsiDetails") + .HasForeignKey("VerifiedCredentialTypeId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_verified_credential_types_verified_cred"); + + b.Navigation("CompanySsiDetailStatus"); + + b.Navigation("ExpiryCheckType"); + + b.Navigation("Process"); + + b.Navigation("VerifiedCredentialExternalTypeDetailVersion"); + + b.Navigation("VerifiedCredentialType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiDetailAssignedDocument", b => + { + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiDetail", "CompanySsiDetail") + .WithMany() + .HasForeignKey("CompanySsiDetailId") + .IsRequired() + .HasConstraintName("fk_company_ssi_detail_assigned_documents_company_ssi_details_c"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .IsRequired() + .HasConstraintName("fk_company_ssi_detail_assigned_documents_documents_document_id"); + + b.Navigation("CompanySsiDetail"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiProcessData", b => + { + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiDetail", "CompanySsiDetail") + .WithOne("CompanySsiProcessData") + .HasForeignKey("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiProcessData", "CompanySsiDetailId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_ssi_process_data_company_ssi_details_company_ssi_de"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeKind", "CredentialTypeKind") + .WithMany("CompanySsiProcessData") + .HasForeignKey("CredentialTypeKindId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_ssi_process_data_verified_credential_type_kinds_cre"); + + b.Navigation("CompanySsiDetail"); + + b.Navigation("CredentialTypeKind"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.Document", b => + { + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.DocumentStatus", "DocumentStatus") + .WithMany("Documents") + .HasForeignKey("DocumentStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_document_status_document_status_id"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.DocumentType", "DocumentType") + .WithMany("Documents") + .HasForeignKey("DocumentTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_document_types_document_type_id"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.MediaType", "MediaType") + .WithMany("Documents") + .HasForeignKey("MediaTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_media_types_media_type_id"); + + b.Navigation("DocumentStatus"); + + b.Navigation("DocumentType"); + + b.Navigation("MediaType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.Process", b => + { + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ProcessType", "ProcessType") + .WithMany("Processes") + .HasForeignKey("ProcessTypeId") + .IsRequired() + .HasConstraintName("fk_processes_process_types_process_type_id"); + + b.Navigation("ProcessType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ProcessStep", b => + { + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.Process", "Process") + .WithMany("ProcessSteps") + .HasForeignKey("ProcessId") + .IsRequired() + .HasConstraintName("fk_process_steps_processes_process_id"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ProcessStepStatus", "ProcessStepStatus") + .WithMany("ProcessSteps") + .HasForeignKey("ProcessStepStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_process_steps_process_step_statuses_process_step_status_id"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ProcessStepType", "ProcessStepType") + .WithMany("ProcessSteps") + .HasForeignKey("ProcessStepTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_process_steps_process_step_types_process_step_type_id"); + + b.Navigation("Process"); + + b.Navigation("ProcessStepStatus"); + + b.Navigation("ProcessStepType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialExternalTypeDetailVersion", b => + { + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialExternalType", "VerifiedCredentialExternalType") + .WithMany("VerifiedCredentialExternalTypeDetailVersions") + .HasForeignKey("VerifiedCredentialExternalTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_external_type_detail_versions_verified_"); + + b.Navigation("VerifiedCredentialExternalType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeAssignedExternalType", b => + { + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialExternalType", "VerifiedCredentialExternalType") + .WithMany("VerifiedCredentialTypeAssignedExternalTypes") + .HasForeignKey("VerifiedCredentialExternalTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_external_types_verified_c"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithOne("VerifiedCredentialTypeAssignedExternalType") + .HasForeignKey("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeAssignedExternalType", "VerifiedCredentialTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_external_types_verified_c1"); + + b.Navigation("VerifiedCredentialExternalType"); + + b.Navigation("VerifiedCredentialType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeAssignedKind", b => + { + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithOne("VerifiedCredentialTypeAssignedKind") + .HasForeignKey("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeAssignedKind", "VerifiedCredentialTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_kinds_verified_credential"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeKind", "VerifiedCredentialTypeKind") + .WithMany("VerifiedCredentialTypeAssignedKinds") + .HasForeignKey("VerifiedCredentialTypeKindId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_kinds_verified_credential1"); + + b.Navigation("VerifiedCredentialType"); + + b.Navigation("VerifiedCredentialTypeKind"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeAssignedUseCase", b => + { + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.UseCase", "UseCase") + .WithOne("VerifiedCredentialAssignedUseCase") + .HasForeignKey("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeAssignedUseCase", "UseCaseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_use_cases_use_cases_use_c"); + + b.HasOne("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithOne("VerifiedCredentialTypeAssignedUseCase") + .HasForeignKey("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeAssignedUseCase", "VerifiedCredentialTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_use_cases_verified_creden"); + + b.Navigation("UseCase"); + + b.Navigation("VerifiedCredentialType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiDetail", b => + { + b.Navigation("CompanySsiProcessData"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.CompanySsiDetailStatus", b => + { + b.Navigation("CompanySsiDetails"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.DocumentStatus", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.DocumentType", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ExpiryCheckType", b => + { + b.Navigation("CompanySsiDetails"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.MediaType", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.Process", b => + { + b.Navigation("CompanySsiDetails"); + + b.Navigation("ProcessSteps"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ProcessStepStatus", b => + { + b.Navigation("ProcessSteps"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ProcessStepType", b => + { + b.Navigation("ProcessSteps"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.ProcessType", b => + { + b.Navigation("Processes"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.UseCase", b => + { + b.Navigation("VerifiedCredentialAssignedUseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialExternalType", b => + { + b.Navigation("VerifiedCredentialExternalTypeDetailVersions"); + + b.Navigation("VerifiedCredentialTypeAssignedExternalTypes"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialExternalTypeDetailVersion", b => + { + b.Navigation("CompanySsiDetails"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialType", b => + { + b.Navigation("CompanySsiDetails"); + + b.Navigation("VerifiedCredentialTypeAssignedExternalType"); + + b.Navigation("VerifiedCredentialTypeAssignedKind"); + + b.Navigation("VerifiedCredentialTypeAssignedUseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Entities.VerifiedCredentialTypeKind", b => + { + b.Navigation("CompanySsiProcessData"); + + b.Navigation("VerifiedCredentialTypeAssignedKinds"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/database/SsiCredentialIssuer.Migrations/Migrations/20240814122258_232-MergeCreateAndSignProcessStep.cs b/src/database/SsiCredentialIssuer.Migrations/Migrations/20240814122258_232-MergeCreateAndSignProcessStep.cs new file mode 100644 index 00000000..df8f5cc2 --- /dev/null +++ b/src/database/SsiCredentialIssuer.Migrations/Migrations/20240814122258_232-MergeCreateAndSignProcessStep.cs @@ -0,0 +1,65 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Migrations.Migrations +{ + /// + public partial class _232MergeCreateAndSignProcessStep : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + schema: "issuer", + table: "process_step_types", + keyColumn: "id", + keyValue: 2); + + migrationBuilder.UpdateData( + schema: "issuer", + table: "process_step_types", + keyColumn: "id", + keyValue: 1, + column: "label", + value: "CREATE_SIGNED_CREDENTIAL"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + schema: "issuer", + table: "process_step_types", + keyColumn: "id", + keyValue: 1, + column: "label", + value: "CREATE_CREDENTIAL"); + + migrationBuilder.InsertData( + schema: "issuer", + table: "process_step_types", + columns: new[] { "id", "label" }, + values: new object[] { 2, "SIGN_CREDENTIAL" }); + } + } +} diff --git a/src/database/SsiCredentialIssuer.Migrations/Migrations/IssuerDbContextModelSnapshot.cs b/src/database/SsiCredentialIssuer.Migrations/Migrations/IssuerDbContextModelSnapshot.cs index e0972ada..bffdf1bf 100644 --- a/src/database/SsiCredentialIssuer.Migrations/Migrations/IssuerDbContextModelSnapshot.cs +++ b/src/database/SsiCredentialIssuer.Migrations/Migrations/IssuerDbContextModelSnapshot.cs @@ -35,7 +35,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder .HasDefaultSchema("issuer") .UseCollation("en_US.utf8") - .HasAnnotation("ProductVersion", "8.0.5") + .HasAnnotation("ProductVersion", "8.0.7") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -947,12 +947,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) new { Id = 1, - Label = "CREATE_CREDENTIAL" - }, - new - { - Id = 2, - Label = "SIGN_CREDENTIAL" + Label = "CREATE_SIGNED_CREDENTIAL" }, new { diff --git a/src/externalservices/Callback.Service/Services/CallbackService.cs b/src/externalservices/Callback.Service/Services/CallbackService.cs index 8a10610c..dd73fd12 100644 --- a/src/externalservices/Callback.Service/Services/CallbackService.cs +++ b/src/externalservices/Callback.Service/Services/CallbackService.cs @@ -28,7 +28,10 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Callback.Service.Services; -public class CallbackService : ICallbackService +public class CallbackService( + ITokenService tokenService, + IOptions options) + : ICallbackService { private static readonly JsonSerializerOptions Options = new() { @@ -36,18 +39,11 @@ public class CallbackService : ICallbackService Converters = { new JsonStringEnumConverter(allowIntegerValues: false) } }; - private readonly ITokenService _tokenService; - private readonly CallbackSettings _settings; - - public CallbackService(ITokenService tokenService, IOptions options) - { - _tokenService = tokenService; - _settings = options.Value; - } + private readonly CallbackSettings _settings = options.Value; public async Task TriggerCallback(string callbackUrl, IssuerResponseData responseData, CancellationToken cancellationToken) { - var client = await _tokenService.GetAuthorizedClient(_settings, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + var client = await tokenService.GetAuthorizedClient(_settings, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await client.PostAsJsonAsync($"{callbackUrl}", responseData, Options, cancellationToken) .CatchingIntoServiceExceptionFor("callback", HttpAsyncResponseMessageExtension.RecoverOptions.REQUEST_EXCEPTION) .ConfigureAwait(false); diff --git a/src/externalservices/Wallet.Service/BusinessLogic/IWalletBusinessLogic.cs b/src/externalservices/Wallet.Service/BusinessLogic/IWalletBusinessLogic.cs index e04edc06..8922d15f 100644 --- a/src/externalservices/Wallet.Service/BusinessLogic/IWalletBusinessLogic.cs +++ b/src/externalservices/Wallet.Service/BusinessLogic/IWalletBusinessLogic.cs @@ -25,8 +25,7 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Wallet.Service.BusinessLogic; public interface IWalletBusinessLogic { - Task CreateCredential(Guid companySsiDetailId, JsonDocument schema, CancellationToken cancellationToken); - Task SignCredential(Guid companySsiDetailId, Guid credentialId, CancellationToken cancellationToken); + Task CreateSignedCredential(Guid companySsiDetailId, JsonDocument schema, CancellationToken cancellationToken); Task CreateCredentialForHolder(Guid companySsiDetailId, string holderWalletUrl, string clientId, EncryptionInformation encryptionInformation, string credential, CancellationToken cancellationToken); Task GetCredential(Guid credentialId, Guid externalCredentialId, VerifiedCredentialTypeKindId kindId, CancellationToken cancellationToken); } diff --git a/src/externalservices/Wallet.Service/BusinessLogic/WalletBusinessLogic.cs b/src/externalservices/Wallet.Service/BusinessLogic/WalletBusinessLogic.cs index 02953370..e25fda78 100644 --- a/src/externalservices/Wallet.Service/BusinessLogic/WalletBusinessLogic.cs +++ b/src/externalservices/Wallet.Service/BusinessLogic/WalletBusinessLogic.cs @@ -41,16 +41,18 @@ public class WalletBusinessLogic( { private readonly WalletSettings _settings = options.Value; - public async Task CreateCredential(Guid companySsiDetailId, JsonDocument schema, CancellationToken cancellationToken) + public async Task CreateSignedCredential(Guid companySsiDetailId, JsonDocument schema, CancellationToken cancellationToken) { - var credentialId = await walletService.CreateCredential(schema, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); - repositories.GetInstance().AttachAndModifyCompanySsiDetails(companySsiDetailId, c => c.ExternalCredentialId = null, c => c.ExternalCredentialId = credentialId); - } - - public async Task SignCredential(Guid companySsiDetailId, Guid credentialId, CancellationToken cancellationToken) - { - var credential = await walletService.SignCredential(credentialId, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); - repositories.GetInstance().AttachAndModifyCompanySsiDetails(companySsiDetailId, c => c.Credential = null, c => c.Credential = credential); + var credential = await walletService.CreateSignedCredential(schema, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + repositories.GetInstance().AttachAndModifyCompanySsiDetails(companySsiDetailId, c => + { + c.ExternalCredentialId = null; + c.Credential = null; + }, c => + { + c.ExternalCredentialId = credential.Id; + c.Credential = credential.Jwt; + }); } public async Task GetCredential(Guid credentialId, Guid externalCredentialId, VerifiedCredentialTypeKindId kindId, CancellationToken cancellationToken) diff --git a/src/externalservices/Wallet.Service/DependencyInjection/WalletSettings.cs b/src/externalservices/Wallet.Service/DependencyInjection/WalletSettings.cs index e8ece8b8..c670e164 100644 --- a/src/externalservices/Wallet.Service/DependencyInjection/WalletSettings.cs +++ b/src/externalservices/Wallet.Service/DependencyInjection/WalletSettings.cs @@ -38,10 +38,10 @@ public class WalletSettings : BasicAuthSettings public string WalletApplication { get; set; } = null!; [Required] - public string CreateCredentialPath { get; set; } = null!; + public string CreateSignedCredentialPath { get; set; } = null!; [Required] - public string SignCredentialPath { get; set; } = null!; + public string CreateCredentialPath { get; set; } = null!; [Required] public string GetCredentialPath { get; set; } = null!; diff --git a/src/externalservices/Wallet.Service/Models/CreateCredentialResponse.cs b/src/externalservices/Wallet.Service/Models/CreateCredentialResponse.cs index 74938f56..167feebb 100644 --- a/src/externalservices/Wallet.Service/Models/CreateCredentialResponse.cs +++ b/src/externalservices/Wallet.Service/Models/CreateCredentialResponse.cs @@ -22,6 +22,22 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Wallet.Service.Models; +public record CreateSignedCredentialRequest( + [property: JsonPropertyName("application")] string Application, + [property: JsonPropertyName("payload")] CreateSignedPayload Payload +); + +public record CreateSignedPayload( + [property: JsonPropertyName("content")] JsonDocument Issue, + [property: JsonPropertyName("signature")] SignData Signature +); + +public record SignData( + [property: JsonPropertyName("proofMechanism")] string ProofMechanism, + [property: JsonPropertyName("proofType")] string ProofType, + [property: JsonPropertyName("keyName")] string? KeyName +); + public record CreateCredentialRequest( [property: JsonPropertyName("application")] string Application, [property: JsonPropertyName("payload")] CredentialPayload Payload @@ -31,6 +47,11 @@ public record CredentialPayload( [property: JsonPropertyName("issue")] JsonDocument Issue ); +public record CreateSignedCredentialResponse( + [property: JsonPropertyName("id")] Guid Id, + [property: JsonPropertyName("jwt")] string Jwt +); + public record CreateCredentialResponse( [property: JsonPropertyName("id")] Guid Id ); diff --git a/src/externalservices/Wallet.Service/Models/SignCredentialRequest.cs b/src/externalservices/Wallet.Service/Models/SignCredentialRequest.cs deleted file mode 100644 index f3dc0442..00000000 --- a/src/externalservices/Wallet.Service/Models/SignCredentialRequest.cs +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2024 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -using System.Text.Json.Serialization; - -namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Wallet.Service.Models; - -public record SignCredentialRequest( - [property: JsonPropertyName("payload")] SignPayload Payload -); - -public record SignPayload( - [property: JsonPropertyName("sign")] SignUpdate Sign -); - -public record SignUpdate( - [property: JsonPropertyName("proofMechanism")] string ProofMechanism, - [property: JsonPropertyName("proofType")] string ProofType -); - -public record SignCredentialResponse( - [property: JsonPropertyName("jwt")] string Jwt -); diff --git a/src/externalservices/Wallet.Service/Services/IWalletService.cs b/src/externalservices/Wallet.Service/Services/IWalletService.cs index 8e0533e5..e09ff8d8 100644 --- a/src/externalservices/Wallet.Service/Services/IWalletService.cs +++ b/src/externalservices/Wallet.Service/Services/IWalletService.cs @@ -17,14 +17,14 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.SsiCredentialIssuer.Wallet.Service.Models; using System.Text.Json; namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Wallet.Service.Services; public interface IWalletService { - Task CreateCredential(JsonDocument payload, CancellationToken cancellationToken); - Task SignCredential(Guid credentialId, CancellationToken cancellationToken); + Task CreateSignedCredential(JsonDocument payload, CancellationToken cancellationToken); Task CreateCredentialForHolder(string holderWalletUrl, string clientId, string clientSecret, string credential, CancellationToken cancellationToken); Task GetCredential(Guid externalCredentialId, CancellationToken cancellationToken); Task RevokeCredentialForIssuer(Guid externalCredentialId, CancellationToken cancellationToken); diff --git a/src/externalservices/Wallet.Service/Services/WalletService.cs b/src/externalservices/Wallet.Service/Services/WalletService.cs index 80bbaebd..7fa1c416 100644 --- a/src/externalservices/Wallet.Service/Services/WalletService.cs +++ b/src/externalservices/Wallet.Service/Services/WalletService.cs @@ -28,7 +28,9 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Wallet.Service.Services; -public class WalletService(IBasicAuthTokenService basicAuthTokenService, IOptions options) +public class WalletService( + IBasicAuthTokenService basicAuthTokenService, + IOptions options) : IWalletService { private const string NoIdErrorMessage = "Response must contain a valid id"; @@ -36,38 +38,21 @@ public class WalletService(IBasicAuthTokenService basicAuthTokenService, IOption private readonly WalletSettings _settings = options.Value; - public async Task CreateCredential(JsonDocument payload, CancellationToken cancellationToken) + public async Task CreateSignedCredential(JsonDocument payload, CancellationToken cancellationToken) { using var client = await basicAuthTokenService.GetBasicAuthorizedClient(_settings, cancellationToken); - var data = new CreateCredentialRequest(_settings.WalletApplication, new CredentialPayload(payload)); - var result = await client.PostAsJsonAsync(_settings.CreateCredentialPath, data, Options, cancellationToken) + var data = new CreateSignedCredentialRequest(_settings.WalletApplication, new CreateSignedPayload(payload, new SignData("external", "jwt", null))); + var result = await client.PostAsJsonAsync(_settings.CreateSignedCredentialPath, data, Options, cancellationToken) .CatchingIntoServiceExceptionFor("create-credential", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE, async x => (false, await x.Content.ReadAsStringAsync().ConfigureAwait(ConfigureAwaitOptions.None))) .ConfigureAwait(false); - var response = await result.Content.ReadFromJsonAsync(Options, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + var response = await result.Content.ReadFromJsonAsync(Options, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); if (response == null) { throw new ConflictException(NoIdErrorMessage); } - return response.Id; - } - - public async Task SignCredential(Guid credentialId, CancellationToken cancellationToken) - { - using var client = await basicAuthTokenService.GetBasicAuthorizedClient(_settings, cancellationToken); - var data = new SignCredentialRequest(new SignPayload(new SignUpdate("external", "jwt"))); - var result = await client.PatchAsJsonAsync(string.Format(_settings.SignCredentialPath, credentialId), data, Options, cancellationToken) - .CatchingIntoServiceExceptionFor("sign-credential", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE, - async x => (false, await x.Content.ReadAsStringAsync().ConfigureAwait(ConfigureAwaitOptions.None))) - .ConfigureAwait(false); - var response = await result.Content.ReadFromJsonAsync(Options, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); - if (response is null) - { - throw new ServiceException(NoIdErrorMessage, true); - } - - return response.Jwt; + return response; } public async Task GetCredential(Guid externalCredentialId, CancellationToken cancellationToken) diff --git a/src/issuer/SsiCredentialIssuer.Service/BusinessLogic/CredentialBusinessLogic.cs b/src/issuer/SsiCredentialIssuer.Service/BusinessLogic/CredentialBusinessLogic.cs index 7e991bdc..7fd1609f 100644 --- a/src/issuer/SsiCredentialIssuer.Service/BusinessLogic/CredentialBusinessLogic.cs +++ b/src/issuer/SsiCredentialIssuer.Service/BusinessLogic/CredentialBusinessLogic.cs @@ -28,20 +28,14 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Service.BusinessLogic; -public class CredentialBusinessLogic : ICredentialBusinessLogic +public class CredentialBusinessLogic(IIssuerRepositories repositories, IIdentityService identityService) + : ICredentialBusinessLogic { - private readonly IIssuerRepositories _repositories; - private readonly IIdentityData _identityData; - - public CredentialBusinessLogic(IIssuerRepositories repositories, IIdentityService identityService) - { - _repositories = repositories; - _identityData = identityService.IdentityData; - } + private readonly IIdentityData _identityData = identityService.IdentityData; public async Task GetCredentialDocument(Guid credentialId) { - var (exists, isSameCompany, documents) = await _repositories.GetInstance().GetSignedCredentialForCredentialId(credentialId, _identityData.Bpnl).ConfigureAwait(ConfigureAwaitOptions.None); + var (exists, isSameCompany, documents) = await repositories.GetInstance().GetSignedCredentialForCredentialId(credentialId, _identityData.Bpnl).ConfigureAwait(ConfigureAwaitOptions.None); if (!exists) { throw NotFoundException.Create(CredentialErrors.CREDENTIAL_NOT_FOUND, new[] { new ErrorParameter("credentialId", credentialId.ToString()) }); @@ -64,7 +58,7 @@ public async Task GetCredentialDocument(Guid credentialId) public async Task<(string FileName, byte[] Content, string MediaType)> GetCredentialDocumentById(Guid documentId) { - var (exists, isSameCompany, fileName, documentStatusId, content, mediaTypeId) = await _repositories.GetInstance().GetDocumentById(documentId, _identityData.Bpnl).ConfigureAwait(ConfigureAwaitOptions.None); + var (exists, isSameCompany, fileName, documentStatusId, content, mediaTypeId) = await repositories.GetInstance().GetDocumentById(documentId, _identityData.Bpnl).ConfigureAwait(ConfigureAwaitOptions.None); if (!exists) { throw NotFoundException.Create(CredentialErrors.DOCUMENT_NOT_FOUND, new[] { new ErrorParameter("documentId", documentId.ToString()) }); diff --git a/src/issuer/SsiCredentialIssuer.Service/BusinessLogic/IssuerBusinessLogic.cs b/src/issuer/SsiCredentialIssuer.Service/BusinessLogic/IssuerBusinessLogic.cs index b1b52548..bdfab341 100644 --- a/src/issuer/SsiCredentialIssuer.Service/BusinessLogic/IssuerBusinessLogic.cs +++ b/src/issuer/SsiCredentialIssuer.Service/BusinessLogic/IssuerBusinessLogic.cs @@ -208,7 +208,7 @@ private Guid CreateProcess() { var processStepRepository = _repositories.GetInstance(); var processId = processStepRepository.CreateProcess(ProcessTypeId.CREATE_CREDENTIAL).Id; - processStepRepository.CreateProcessStep(ProcessStepTypeId.CREATE_CREDENTIAL, ProcessStepStatusId.TODO, processId); + processStepRepository.CreateProcessStep(ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL, ProcessStepStatusId.TODO, processId); return processId; } diff --git a/src/issuer/SsiCredentialIssuer.Service/appsettings.json b/src/issuer/SsiCredentialIssuer.Service/appsettings.json index fcac2380..999997d1 100644 --- a/src/issuer/SsiCredentialIssuer.Service/appsettings.json +++ b/src/issuer/SsiCredentialIssuer.Service/appsettings.json @@ -65,8 +65,8 @@ "EncryptionConfigIndex": 0, "EncryptionConfigs": [], "WalletApplication": "", + "CreateSignedCredentialPath": "", "CreateCredentialPath": "", - "SignCredentialPath": "", "GetCredentialPath": "", "RevokeCredentialPath": "" }, diff --git a/src/processes/CredentialProcess.Library/Creation/CredentialCreationProcessHandler.cs b/src/processes/CredentialProcess.Library/Creation/CredentialCreationProcessHandler.cs index e898ea10..49c684ac 100644 --- a/src/processes/CredentialProcess.Library/Creation/CredentialCreationProcessHandler.cs +++ b/src/processes/CredentialProcess.Library/Creation/CredentialCreationProcessHandler.cs @@ -28,39 +28,16 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.CredentialProcess.Library.Creation; -public class CredentialCreationProcessHandler : ICredentialCreationProcessHandler +public class CredentialCreationProcessHandler( + IIssuerRepositories issuerRepositories, + IWalletBusinessLogic walletBusinessLogic, + ICallbackService callbackService) + : ICredentialCreationProcessHandler { - private readonly IIssuerRepositories _issuerRepositories; - private readonly IWalletBusinessLogic _walletBusinessLogic; - private readonly ICallbackService _callbackService; - - public CredentialCreationProcessHandler(IIssuerRepositories issuerRepositories, IWalletBusinessLogic walletBusinessLogic, ICallbackService callbackService) - { - _issuerRepositories = issuerRepositories; - _walletBusinessLogic = walletBusinessLogic; - _callbackService = callbackService; - } - - public async Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> CreateCredential(Guid credentialId, CancellationToken cancellationToken) + public async Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> CreateSignedCredential(Guid credentialId, CancellationToken cancellationToken) { - var data = await _issuerRepositories.GetInstance().GetCredentialStorageInformationById(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); - await _walletBusinessLogic.CreateCredential(credentialId, data.Schema, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); - return ( - Enumerable.Repeat(ProcessStepTypeId.SIGN_CREDENTIAL, 1), - ProcessStepStatusId.DONE, - false, - null); - } - - public async Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> SignCredential(Guid credentialId, CancellationToken cancellationToken) - { - var externalCredentialId = await _issuerRepositories.GetInstance().GetWalletCredentialId(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); - if (externalCredentialId is null) - { - throw new ConflictException("ExternalCredentialId must be set here"); - } - - await _walletBusinessLogic.SignCredential(credentialId, externalCredentialId!.Value, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + var data = await issuerRepositories.GetInstance().GetCredentialStorageInformationById(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); + await walletBusinessLogic.CreateSignedCredential(credentialId, data.Schema, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); return ( Enumerable.Repeat(ProcessStepTypeId.SAVE_CREDENTIAL_DOCUMENT, 1), ProcessStepStatusId.DONE, @@ -70,13 +47,13 @@ public CredentialCreationProcessHandler(IIssuerRepositories issuerRepositories, public async Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> SaveCredentialDocument(Guid credentialId, CancellationToken cancellationToken) { - var (externalCredentialId, kindId, hasEncryptionInformation, callbackUrl) = await _issuerRepositories.GetInstance().GetExternalCredentialAndKindId(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); + var (externalCredentialId, kindId, hasEncryptionInformation, callbackUrl) = await issuerRepositories.GetInstance().GetExternalCredentialAndKindId(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); if (externalCredentialId == null) { throw new ConflictException("ExternalCredentialId must be set here"); } - await _walletBusinessLogic.GetCredential(credentialId, externalCredentialId.Value, kindId, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + await walletBusinessLogic.GetCredential(credentialId, externalCredentialId.Value, kindId, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); var nextProcessStep = callbackUrl == null ? null : Enumerable.Repeat(ProcessStepTypeId.TRIGGER_CALLBACK, 1); return ( hasEncryptionInformation @@ -89,7 +66,7 @@ public CredentialCreationProcessHandler(IIssuerRepositories issuerRepositories, public async Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> CreateCredentialForHolder(Guid credentialId, CancellationToken cancellationToken) { - var (holderWalletData, credential, encryptionInformation, callbackUrl) = await _issuerRepositories.GetInstance().GetCredentialData(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); + var (holderWalletData, credential, encryptionInformation, callbackUrl) = await issuerRepositories.GetInstance().GetCredentialData(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); if (credential is null) { throw new ConflictException("Credential must be set here"); @@ -105,7 +82,7 @@ public CredentialCreationProcessHandler(IIssuerRepositories issuerRepositories, throw new ConflictException("Wallet secret must be set"); } - await _walletBusinessLogic.CreateCredentialForHolder(credentialId, holderWalletData.WalletUrl, holderWalletData.ClientId, new EncryptionInformation(encryptionInformation.Secret, encryptionInformation.InitializationVector, encryptionInformation.EncryptionMode.Value), credential, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + await walletBusinessLogic.CreateCredentialForHolder(credentialId, holderWalletData.WalletUrl, holderWalletData.ClientId, new EncryptionInformation(encryptionInformation.Secret, encryptionInformation.InitializationVector, encryptionInformation.EncryptionMode.Value), credential, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); return ( callbackUrl is null ? null : Enumerable.Repeat(ProcessStepTypeId.TRIGGER_CALLBACK, 1), ProcessStepStatusId.DONE, @@ -115,14 +92,14 @@ public CredentialCreationProcessHandler(IIssuerRepositories issuerRepositories, public async Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> TriggerCallback(Guid credentialId, CancellationToken cancellationToken) { - var (bpn, callbackUrl) = await _issuerRepositories.GetInstance().GetCallbackUrl(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); + var (bpn, callbackUrl) = await issuerRepositories.GetInstance().GetCallbackUrl(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); if (callbackUrl is null) { throw new ConflictException("CallbackUrl must be set"); } var issuerResponseData = new IssuerResponseData(bpn, IssuerResponseStatus.SUCCESSFUL, "Successfully created Credential"); - await _callbackService.TriggerCallback(callbackUrl, issuerResponseData, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + await callbackService.TriggerCallback(callbackUrl, issuerResponseData, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); return ( null, ProcessStepStatusId.DONE, diff --git a/src/processes/CredentialProcess.Library/Creation/ICredentialCreationProcessHandler.cs b/src/processes/CredentialProcess.Library/Creation/ICredentialCreationProcessHandler.cs index f68c31ab..b98cb64e 100644 --- a/src/processes/CredentialProcess.Library/Creation/ICredentialCreationProcessHandler.cs +++ b/src/processes/CredentialProcess.Library/Creation/ICredentialCreationProcessHandler.cs @@ -23,8 +23,7 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.CredentialProcess.Library.Cre public interface ICredentialCreationProcessHandler { - Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> CreateCredential(Guid credentialId, CancellationToken cancellationToken); - Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> SignCredential(Guid credentialId, CancellationToken cancellationToken); + Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> CreateSignedCredential(Guid credentialId, CancellationToken cancellationToken); Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> SaveCredentialDocument(Guid credentialId, CancellationToken cancellationToken); Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> CreateCredentialForHolder(Guid credentialId, CancellationToken cancellationToken); Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> TriggerCallback(Guid credentialId, CancellationToken cancellationToken); diff --git a/src/processes/CredentialProcess.Library/Expiry/CredentialExpiryProcessHandler.cs b/src/processes/CredentialProcess.Library/Expiry/CredentialExpiryProcessHandler.cs index 1660e571..0e5ab365 100644 --- a/src/processes/CredentialProcess.Library/Expiry/CredentialExpiryProcessHandler.cs +++ b/src/processes/CredentialProcess.Library/Expiry/CredentialExpiryProcessHandler.cs @@ -30,23 +30,17 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.CredentialProcess.Library.Expiry; -public class CredentialExpiryProcessHandler : ICredentialExpiryProcessHandler +public class CredentialExpiryProcessHandler( + IIssuerRepositories repositories, + IWalletService walletService, + IPortalService portalService) + : ICredentialExpiryProcessHandler { private static readonly JsonSerializerOptions Options = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; - private readonly IIssuerRepositories _repositories; - private readonly IWalletService _walletService; - private readonly IPortalService _portalService; - - public CredentialExpiryProcessHandler(IIssuerRepositories repositories, IWalletService walletService, IPortalService portalService) - { - _repositories = repositories; - _walletService = walletService; - _portalService = portalService; - } public async Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> RevokeCredential(Guid credentialId, CancellationToken cancellationToken) { - var credentialRepository = _repositories.GetInstance(); + var credentialRepository = repositories.GetInstance(); var data = await credentialRepository.GetRevocationDataById(credentialId, string.Empty) .ConfigureAwait(ConfigureAwaitOptions.None); if (!data.Exists) @@ -60,9 +54,9 @@ public CredentialExpiryProcessHandler(IIssuerRepositories repositories, IWalletS } // call walletService - await _walletService.RevokeCredentialForIssuer(data.ExternalCredentialId.Value, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + await walletService.RevokeCredentialForIssuer(data.ExternalCredentialId.Value, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); - _repositories.GetInstance().AttachAndModifyDocuments( + repositories.GetInstance().AttachAndModifyDocuments( data.Documents.Select(d => new ValueTuple?, Action>( d.DocumentId, document => document.DocumentStatusId = d.DocumentStatusId, @@ -82,11 +76,11 @@ public CredentialExpiryProcessHandler(IIssuerRepositories repositories, IWalletS public async Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> TriggerNotification(Guid credentialId, CancellationToken cancellationToken) { - var (typeId, requesterId) = await _repositories.GetInstance().GetCredentialNotificationData(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); + var (typeId, requesterId) = await repositories.GetInstance().GetCredentialNotificationData(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); if (Guid.TryParse(requesterId, out var companyUserId)) { var content = JsonSerializer.Serialize(new { Type = typeId, CredentialId = credentialId }, Options); - await _portalService.AddNotification(content, companyUserId, NotificationTypeId.CREDENTIAL_REJECTED, cancellationToken); + await portalService.AddNotification(content, companyUserId, NotificationTypeId.CREDENTIAL_REJECTED, cancellationToken); } return ( @@ -98,7 +92,7 @@ public CredentialExpiryProcessHandler(IIssuerRepositories repositories, IWalletS public async Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> TriggerMail(Guid credentialId, CancellationToken cancellationToken) { - var (typeId, requesterId) = await _repositories.GetInstance().GetCredentialNotificationData(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); + var (typeId, requesterId) = await repositories.GetInstance().GetCredentialNotificationData(credentialId).ConfigureAwait(ConfigureAwaitOptions.None); var typeValue = typeId.GetEnumValue() ?? throw new UnexpectedConditionException($"VerifiedCredentialType {typeId} does not exists"); if (Guid.TryParse(requesterId, out var companyUserId)) @@ -107,7 +101,7 @@ public CredentialExpiryProcessHandler(IIssuerRepositories repositories, IWalletS { new("requestName", typeValue), new("reason", "The credential is already expired") }; - await _portalService.TriggerMail("CredentialRejected", companyUserId, mailParameters, cancellationToken); + await portalService.TriggerMail("CredentialRejected", companyUserId, mailParameters, cancellationToken); } return ( diff --git a/src/processes/CredentialProcess.Worker/Creation/CredentialCreationProcessTypeExecutor.cs b/src/processes/CredentialProcess.Worker/Creation/CredentialCreationProcessTypeExecutor.cs index 69357b87..fcbe97f7 100644 --- a/src/processes/CredentialProcess.Worker/Creation/CredentialCreationProcessTypeExecutor.cs +++ b/src/processes/CredentialProcess.Worker/Creation/CredentialCreationProcessTypeExecutor.cs @@ -27,28 +27,19 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.CredentialProcess.Worker.Creation; -public class CredentialCreationProcessTypeExecutor : IProcessTypeExecutor +public class CredentialCreationProcessTypeExecutor( + IIssuerRepositories issuerRepositories, + ICredentialCreationProcessHandler credentialCreationProcessHandler) + : IProcessTypeExecutor { - private readonly IIssuerRepositories _issuerRepositories; - private readonly ICredentialCreationProcessHandler _credentialCreationProcessHandler; - private readonly IEnumerable _executableProcessSteps = ImmutableArray.Create( - ProcessStepTypeId.CREATE_CREDENTIAL, - ProcessStepTypeId.SIGN_CREDENTIAL, + ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL, ProcessStepTypeId.SAVE_CREDENTIAL_DOCUMENT, ProcessStepTypeId.CREATE_CREDENTIAL_FOR_HOLDER, ProcessStepTypeId.TRIGGER_CALLBACK); private Guid _credentialId; - public CredentialCreationProcessTypeExecutor( - IIssuerRepositories issuerRepositories, - ICredentialCreationProcessHandler credentialCreationProcessHandler) - { - _issuerRepositories = issuerRepositories; - _credentialCreationProcessHandler = credentialCreationProcessHandler; - } - public ProcessTypeId GetProcessTypeId() => ProcessTypeId.CREATE_CREDENTIAL; public bool IsExecutableStepTypeId(ProcessStepTypeId processStepTypeId) => _executableProcessSteps.Contains(processStepTypeId); public IEnumerable GetExecutableStepTypeIds() => _executableProcessSteps; @@ -56,7 +47,7 @@ public CredentialCreationProcessTypeExecutor( public async ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds) { - var (exists, credentialId) = await _issuerRepositories.GetInstance().GetDataForProcessId(processId).ConfigureAwait(ConfigureAwaitOptions.None); + var (exists, credentialId) = await issuerRepositories.GetInstance().GetDataForProcessId(processId).ConfigureAwait(ConfigureAwaitOptions.None); if (!exists) { throw new NotFoundException($"process {processId} does not exist or is not associated with an credential"); @@ -82,15 +73,13 @@ public CredentialCreationProcessTypeExecutor( { (nextStepTypeIds, stepStatusId, modified, processMessage) = processStepTypeId switch { - ProcessStepTypeId.CREATE_CREDENTIAL => await _credentialCreationProcessHandler.CreateCredential(_credentialId, cancellationToken) - .ConfigureAwait(ConfigureAwaitOptions.None), - ProcessStepTypeId.SIGN_CREDENTIAL => await _credentialCreationProcessHandler.SignCredential(_credentialId, cancellationToken) + ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL => await credentialCreationProcessHandler.CreateSignedCredential(_credentialId, cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None), - ProcessStepTypeId.SAVE_CREDENTIAL_DOCUMENT => await _credentialCreationProcessHandler.SaveCredentialDocument(_credentialId, cancellationToken) + ProcessStepTypeId.SAVE_CREDENTIAL_DOCUMENT => await credentialCreationProcessHandler.SaveCredentialDocument(_credentialId, cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None), - ProcessStepTypeId.CREATE_CREDENTIAL_FOR_HOLDER => await _credentialCreationProcessHandler.CreateCredentialForHolder(_credentialId, cancellationToken) + ProcessStepTypeId.CREATE_CREDENTIAL_FOR_HOLDER => await credentialCreationProcessHandler.CreateCredentialForHolder(_credentialId, cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None), - ProcessStepTypeId.TRIGGER_CALLBACK => await _credentialCreationProcessHandler.TriggerCallback(_credentialId, cancellationToken) + ProcessStepTypeId.TRIGGER_CALLBACK => await credentialCreationProcessHandler.TriggerCallback(_credentialId, cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None), _ => (null, ProcessStepStatusId.TODO, false, null) }; diff --git a/src/processes/Processes.Worker/appsettings.json b/src/processes/Processes.Worker/appsettings.json index 76c9e70f..453545dc 100644 --- a/src/processes/Processes.Worker/appsettings.json +++ b/src/processes/Processes.Worker/appsettings.json @@ -49,8 +49,8 @@ "EncryptionConfigIndex": 0, "EncryptionConfigs": [], "WalletApplication": "", + "CreateSignedCredentialPath": "", "CreateCredentialPath": "", - "SignCredentialPath": "", "GetCredentialPath": "", "RevokeCredentialPath": "" } diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/ProcessStepRepositoryTests.cs b/tests/database/SsiCredentialIssuer.DbAccess.Tests/ProcessStepRepositoryTests.cs index f8bf2b26..fc2fe9e7 100644 --- a/tests/database/SsiCredentialIssuer.DbAccess.Tests/ProcessStepRepositoryTests.cs +++ b/tests/database/SsiCredentialIssuer.DbAccess.Tests/ProcessStepRepositoryTests.cs @@ -120,7 +120,7 @@ public async Task CreateProcessStep_CreateSuccessfully() var changeTracker = dbContext.ChangeTracker; // Act - sut.CreateProcessStep(ProcessStepTypeId.SIGN_CREDENTIAL, ProcessStepStatusId.TODO, processId); + sut.CreateProcessStep(ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL, ProcessStepStatusId.TODO, processId); // Assert changeTracker.HasChanges().Should().BeTrue(); @@ -129,7 +129,7 @@ public async Task CreateProcessStep_CreateSuccessfully() .Which.State.Should().Be(EntityState.Added); changeTracker.Entries().Select(x => x.Entity).Cast() .Should().Satisfy( - x => x.ProcessId == processId && x.ProcessStepTypeId == ProcessStepTypeId.SIGN_CREDENTIAL && x.ProcessStepStatusId == ProcessStepStatusId.TODO + x => x.ProcessId == processId && x.ProcessStepTypeId == ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL && x.ProcessStepStatusId == ProcessStepStatusId.TODO ); } @@ -287,8 +287,7 @@ public async Task GetActiveProcess_LockExpired_ReturnsExpected() // Arrange var processTypeIds = new[] { ProcessTypeId.CREATE_CREDENTIAL }; var processStepTypeIds = new[] { - ProcessStepTypeId.CREATE_CREDENTIAL, - ProcessStepTypeId.SIGN_CREDENTIAL, + ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL, ProcessStepTypeId.SAVE_CREDENTIAL_DOCUMENT, ProcessStepTypeId.CREATE_CREDENTIAL_FOR_HOLDER, }; @@ -309,8 +308,7 @@ public async Task GetActiveProcess_Locked_ReturnsExpected() // Arrange var processTypeIds = new[] { ProcessTypeId.CREATE_CREDENTIAL }; var processStepTypeIds = new[] { - ProcessStepTypeId.CREATE_CREDENTIAL, - ProcessStepTypeId.SIGN_CREDENTIAL, + ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL, ProcessStepTypeId.SAVE_CREDENTIAL_DOCUMENT, ProcessStepTypeId.CREATE_CREDENTIAL_FOR_HOLDER, }; diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/process_steps.test.json b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/process_steps.test.json index 5b84489a..4826e8ab 100644 --- a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/process_steps.test.json +++ b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/process_steps.test.json @@ -7,14 +7,6 @@ "date_created": "2023-02-21 08:15:20.479000 +00:00", "date_last_changed": null }, - { - "id": "629cc08f-bb0b-43ba-b20a-45c3538789b5", - "process_step_type_id": 2, - "process_step_status_id": 2, - "process_id": "dd371565-9489-4907-a2e4-b8cbfe7a8cd2", - "date_created": "2023-02-21 08:15:20.479000 +00:00", - "date_last_changed": null - }, { "id": "cd231cb8-55de-4ae4-b93f-d440512341fb", "process_step_type_id": 3, diff --git a/tests/externalservices/Wallet.Service.Tests/BusinessLogic/WalletBusinessLogicTests.cs b/tests/externalservices/Wallet.Service.Tests/BusinessLogic/WalletBusinessLogicTests.cs index b29766be..f053ffbb 100644 --- a/tests/externalservices/Wallet.Service.Tests/BusinessLogic/WalletBusinessLogicTests.cs +++ b/tests/externalservices/Wallet.Service.Tests/BusinessLogic/WalletBusinessLogicTests.cs @@ -81,48 +81,18 @@ public async Task CreateCredential_CallsExpected() initialize?.Invoke(ssiDetail); setupOptionalFields(ssiDetail); }); - A.CallTo(() => _walletService.CreateCredential(schema, A._)) - .Returns(externalId); + A.CallTo(() => _walletService.CreateSignedCredential(schema, A._)) + .Returns(new CreateSignedCredentialResponse(externalId, "cred")); // Act - await _sut.CreateCredential(id, schema, CancellationToken.None); + await _sut.CreateSignedCredential(id, schema, CancellationToken.None); // Assert A.CallTo(() => _companySsiDetailRepository.AttachAndModifyCompanySsiDetails(id, A>._, A>._)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _walletService.CreateCredential(schema, A._)) - .MustHaveHappenedOnceExactly(); - ssiDetail.ExternalCredentialId = externalId; - } - - #endregion - - #region SignCredential - - [Fact] - public async Task SignCredential_CallsExpected() - { - // Arrange - var id = Guid.NewGuid(); - var credentialId = Guid.NewGuid(); - var ssiDetail = new CompanySsiDetail(id, null!, VerifiedCredentialTypeId.BUSINESS_PARTNER_NUMBER, CompanySsiDetailStatusId.ACTIVE, IssuerBpnl, Guid.NewGuid().ToString(), DateTimeOffset.UtcNow); - A.CallTo(() => _companySsiDetailRepository.AttachAndModifyCompanySsiDetails(A._, A>._, A>._)) - .Invokes((Guid _, Action? initialize, Action setupOptionalFields) => - { - initialize?.Invoke(ssiDetail); - setupOptionalFields(ssiDetail); - }); - A.CallTo(() => _walletService.SignCredential(credentialId, A._)) - .Returns("cred"); - - // Act - await _sut.SignCredential(id, credentialId, CancellationToken.None); - - // Assert - A.CallTo(() => _companySsiDetailRepository.AttachAndModifyCompanySsiDetails(id, A>._, A>._)) - .MustHaveHappenedOnceExactly(); - A.CallTo(() => _walletService.SignCredential(credentialId, A._)) + A.CallTo(() => _walletService.CreateSignedCredential(schema, A._)) .MustHaveHappenedOnceExactly(); + ssiDetail.ExternalCredentialId.Should().Be(externalId); ssiDetail.Credential.Should().Be("cred"); } diff --git a/tests/externalservices/Wallet.Service.Tests/Services/WalletServiceTests.cs b/tests/externalservices/Wallet.Service.Tests/Services/WalletServiceTests.cs index 31e19fed..e967fde4 100644 --- a/tests/externalservices/Wallet.Service.Tests/Services/WalletServiceTests.cs +++ b/tests/externalservices/Wallet.Service.Tests/Services/WalletServiceTests.cs @@ -40,8 +40,8 @@ public WalletServiceTests() TokenAddress = "https://example.org/token", EncryptionConfigIndex = 0, WalletApplication = "catena-x-portal", + CreateSignedCredentialPath = "/api/v2.0.0/credentials", CreateCredentialPath = "api/v2.0.0/credentials", - SignCredentialPath = "/api/v2.0.0/credentials/{0}", GetCredentialPath = "/api/v2.0.0/credentials/{0}", RevokeCredentialPath = "/api/v2.0.0/credentials/{0}" }); @@ -66,15 +66,17 @@ public async Task CreateCredential_WithValid_DoesNotThrowException() .Returns(httpClient); // Act - var result = await _sut.CreateCredential(payload, CancellationToken.None); + var result = await _sut.CreateSignedCredential(payload, CancellationToken.None); // Assert httpMessageHandlerMock.RequestMessage.Should().Match(x => x.Content is JsonContent && - (x.Content as JsonContent)!.ObjectType == typeof(CreateCredentialRequest) && - ((x.Content as JsonContent)!.Value as CreateCredentialRequest)!.Application == "catena-x-portal" + (x.Content as JsonContent)!.ObjectType == typeof(CreateSignedCredentialRequest) && + ((x.Content as JsonContent)!.Value as CreateSignedCredentialRequest)!.Application == "catena-x-portal" && + ((x.Content as JsonContent)!.Value as CreateSignedCredentialRequest)!.Payload.Signature.ProofMechanism == "external" && + ((x.Content as JsonContent)!.Value as CreateSignedCredentialRequest)!.Payload.Signature.ProofType == "jwt" ); - result.Should().Be(id); + result.Should().BeOfType().Which.Id.Should().Be(id); } [Theory] @@ -96,66 +98,7 @@ public async Task CreateCredential_WithConflict_ThrowsServiceExceptionWithErrorC A.CallTo(() => _basicAuthTokenService.GetBasicAuthorizedClient(_options.Value, A._)).Returns(httpClient); // Act - async Task Act() => await _sut.CreateCredential(payload, CancellationToken.None); - - // Assert - var ex = await Assert.ThrowsAsync(Act); - ex.Message.Should().Be(message); - ex.StatusCode.Should().Be(statusCode); - } - - #endregion - - #region SignCredential - - [Fact] - public async Task SignCredential_WithValid_DoesNotThrowException() - { - // Arrange - var credentialId = Guid.NewGuid(); - const string jwt = "thisisonlyatestexample"; - var response = new SignCredentialResponse(jwt); - var httpMessageHandlerMock = new HttpMessageHandlerMock(HttpStatusCode.OK, new StringContent(JsonSerializer.Serialize(response))); - using var httpClient = new HttpClient(httpMessageHandlerMock) - { - BaseAddress = new Uri("https://base.address.com") - }; - A.CallTo(() => _basicAuthTokenService.GetBasicAuthorizedClient(_options.Value, A._)) - .Returns(httpClient); - - // Act - var result = await _sut.SignCredential(credentialId, CancellationToken.None); - - // Assert - httpMessageHandlerMock.RequestMessage.Should().Match(x => - x.Content is JsonContent && - (x.Content as JsonContent)!.ObjectType == typeof(SignCredentialRequest) && - ((x.Content as JsonContent)!.Value as SignCredentialRequest)!.Payload.Sign.ProofMechanism == "external" && - ((x.Content as JsonContent)!.Value as SignCredentialRequest)!.Payload.Sign.ProofType == "jwt" - ); - result.Should().Be(jwt); - } - - [Theory] - [InlineData(HttpStatusCode.Conflict, "{ \"message\": \"Framework test!\" }", "call to external system sign-credential failed with statuscode 409 - Message: { \"message\": \"Framework test!\" }")] - [InlineData(HttpStatusCode.BadRequest, "{ \"test\": \"123\" }", "call to external system sign-credential failed with statuscode 400 - Message: { \"test\": \"123\" }")] - [InlineData(HttpStatusCode.BadRequest, "this is no json", "call to external system sign-credential failed with statuscode 400 - Message: this is no json")] - [InlineData(HttpStatusCode.Forbidden, null, "call to external system sign-credential failed with statuscode 403")] - public async Task SignCredential_WithConflict_ThrowsServiceExceptionWithErrorContent(HttpStatusCode statusCode, string? content, string message) - { - // Arrange - var credentialId = Guid.NewGuid(); - var httpMessageHandlerMock = content == null - ? new HttpMessageHandlerMock(statusCode) - : new HttpMessageHandlerMock(statusCode, new StringContent(content)); - using var httpClient = new HttpClient(httpMessageHandlerMock) - { - BaseAddress = new Uri("https://base.address.com") - }; - A.CallTo(() => _basicAuthTokenService.GetBasicAuthorizedClient(_options.Value, A._)).Returns(httpClient); - - // Act - async Task Act() => await _sut.SignCredential(credentialId, CancellationToken.None); + async Task Act() => await _sut.CreateSignedCredential(payload, CancellationToken.None); // Assert var ex = await Assert.ThrowsAsync(Act); diff --git a/tests/issuer/SsiCredentialIssuer.Service.Tests/appsettings.IntegrationTests.json b/tests/issuer/SsiCredentialIssuer.Service.Tests/appsettings.IntegrationTests.json index 427e5599..e9eca2ef 100644 --- a/tests/issuer/SsiCredentialIssuer.Service.Tests/appsettings.IntegrationTests.json +++ b/tests/issuer/SsiCredentialIssuer.Service.Tests/appsettings.IntegrationTests.json @@ -64,8 +64,8 @@ } ], "WalletApplication": "catena-x-portal", + "CreateSignedCredentialPath": "/api/v2.0.0/credentials", "CreateCredentialPath": "api/v2.0.0/credentials", - "SignCredentialPath": "/api/v2.0.0/credentials/{0}", "GetCredentialPath": "/api/v2.0.0/credentials/{0}", "RevokeCredentialPath": "/api/v2.0.0/credentials/{0}" } diff --git a/tests/processes/CredentialProcess.Library.Tests/CredentialCreationProcessHandlerTests.cs b/tests/processes/CredentialProcess.Library.Tests/CredentialCreationProcessHandlerTests.cs index 57862757..c0473bed 100644 --- a/tests/processes/CredentialProcess.Library.Tests/CredentialCreationProcessHandlerTests.cs +++ b/tests/processes/CredentialProcess.Library.Tests/CredentialCreationProcessHandlerTests.cs @@ -41,7 +41,6 @@ public class CredentialCreationProcessHandlerTests private readonly Guid _credentialId = Guid.NewGuid(); private readonly IWalletBusinessLogic _walletBusinessLogic; - private readonly IIssuerRepositories _issuerRepositories; private readonly ICredentialRepository _credentialRepository; private readonly CredentialCreationProcessHandler _sut; @@ -55,15 +54,15 @@ public CredentialCreationProcessHandlerTests() .ForEach(b => _fixture.Behaviors.Remove(b)); _fixture.Behaviors.Add(new OmitOnRecursionBehavior()); - _issuerRepositories = A.Fake(); + var issuerRepositories = A.Fake(); _credentialRepository = A.Fake(); - A.CallTo(() => _issuerRepositories.GetInstance()).Returns(_credentialRepository); + A.CallTo(() => issuerRepositories.GetInstance()).Returns(_credentialRepository); _walletBusinessLogic = A.Fake(); _callbackService = A.Fake(); - _sut = new CredentialCreationProcessHandler(_issuerRepositories, _walletBusinessLogic, _callbackService); + _sut = new CredentialCreationProcessHandler(issuerRepositories, _walletBusinessLogic, _callbackService); } #region CreateCredential @@ -76,50 +75,10 @@ public async Task CreateCredential_WithValidData_ReturnsExpected() .Returns(default((VerifiedCredentialTypeKindId, JsonDocument))); // Act - var result = await _sut.CreateCredential(_credentialId, CancellationToken.None); + var result = await _sut.CreateSignedCredential(_credentialId, CancellationToken.None); // Assert - A.CallTo(() => _walletBusinessLogic.CreateCredential(_credentialId, A._, A._)) - .MustHaveHappenedOnceExactly(); - - result.modified.Should().BeFalse(); - result.processMessage.Should().BeNull(); - result.stepStatusId.Should().Be(ProcessStepStatusId.DONE); - result.nextStepTypeIds.Should().ContainSingle().Which.Should().Be(ProcessStepTypeId.SIGN_CREDENTIAL); - } - - #endregion - - #region SignCredential - - [Fact] - public async Task SignCredential_WithNotExisting_ReturnsExpected() - { - // Arrange - A.CallTo(() => _credentialRepository.GetWalletCredentialId(_credentialId)) - .Returns(null); - Task Act() => _sut.SignCredential(_credentialId, CancellationToken.None); - - // Act - var ex = await Assert.ThrowsAsync(Act); - - // Assert - ex.Message.Should().Be("ExternalCredentialId must be set here"); - } - - [Fact] - public async Task SignCredential_WithValidData_ReturnsExpected() - { - // Arrange - var externalCredentialId = Guid.NewGuid(); - A.CallTo(() => _credentialRepository.GetWalletCredentialId(_credentialId)) - .Returns(externalCredentialId); - - // Act - var result = await _sut.SignCredential(_credentialId, CancellationToken.None); - - // Assert - A.CallTo(() => _walletBusinessLogic.SignCredential(_credentialId, externalCredentialId, A._)) + A.CallTo(() => _walletBusinessLogic.CreateSignedCredential(_credentialId, A._, A._)) .MustHaveHappenedOnceExactly(); result.modified.Should().BeFalse(); diff --git a/tests/processes/CredentialProcess.Worker.Tests/CredentialCreationProcessTypeExecutorTests.cs b/tests/processes/CredentialProcess.Worker.Tests/CredentialCreationProcessTypeExecutorTests.cs index 16a6220d..d327838e 100644 --- a/tests/processes/CredentialProcess.Worker.Tests/CredentialCreationProcessTypeExecutorTests.cs +++ b/tests/processes/CredentialProcess.Worker.Tests/CredentialCreationProcessTypeExecutorTests.cs @@ -65,16 +65,15 @@ public void GetProcessTypeId_ReturnsExpected() public void IsExecutableStepTypeId_WithValid_ReturnsExpected() { // Assert - _sut.IsExecutableStepTypeId(ProcessStepTypeId.SIGN_CREDENTIAL).Should().BeTrue(); + _sut.IsExecutableStepTypeId(ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL).Should().BeTrue(); } [Fact] public void GetExecutableStepTypeIds_ReturnsExpected() { // Assert - _sut.GetExecutableStepTypeIds().Should().HaveCount(5).And.Satisfy( - x => x == ProcessStepTypeId.CREATE_CREDENTIAL, - x => x == ProcessStepTypeId.SIGN_CREDENTIAL, + _sut.GetExecutableStepTypeIds().Should().HaveCount(4).And.Satisfy( + x => x == ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL, x => x == ProcessStepTypeId.SAVE_CREDENTIAL_DOCUMENT, x => x == ProcessStepTypeId.CREATE_CREDENTIAL_FOR_HOLDER, x => x == ProcessStepTypeId.TRIGGER_CALLBACK); @@ -84,7 +83,7 @@ public void GetExecutableStepTypeIds_ReturnsExpected() public async Task IsLockRequested_ReturnsExpected() { // Act - var result = await _sut.IsLockRequested(ProcessStepTypeId.SIGN_CREDENTIAL); + var result = await _sut.IsLockRequested(ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL); // Assert result.Should().BeFalse(); @@ -132,7 +131,7 @@ public async Task InitializeProcess_WithNotExistingProcess_ThrowsNotFoundExcepti public async Task ExecuteProcessStep_WithoutRegistrationId_ThrowsUnexpectedConditionException() { // Act - async Task Act() => await _sut.ExecuteProcessStep(ProcessStepTypeId.SIGN_CREDENTIAL, Enumerable.Empty(), CancellationToken.None); + async Task Act() => await _sut.ExecuteProcessStep(ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL, Enumerable.Empty(), CancellationToken.None); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -156,11 +155,11 @@ public async Task ExecuteProcessStep_WithValidData_CallsExpected() initializeResult.ScheduleStepTypeIds.Should().BeNull(); // Arrange - A.CallTo(() => _credentialCreationProcessHandler.CreateCredential(credentialId, A._)) + A.CallTo(() => _credentialCreationProcessHandler.CreateSignedCredential(credentialId, A._)) .Returns((null, ProcessStepStatusId.DONE, false, null)); // Act - var result = await _sut.ExecuteProcessStep(ProcessStepTypeId.CREATE_CREDENTIAL, Enumerable.Empty(), CancellationToken.None); + var result = await _sut.ExecuteProcessStep(ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL, Enumerable.Empty(), CancellationToken.None); // Assert result.Modified.Should().BeFalse(); @@ -187,11 +186,11 @@ public async Task ExecuteProcessStep_WithRecoverableServiceException_ReturnsToDo initializeResult.ScheduleStepTypeIds.Should().BeNull(); // Arrange - A.CallTo(() => _credentialCreationProcessHandler.CreateCredential(credentialId, A._)) + A.CallTo(() => _credentialCreationProcessHandler.CreateSignedCredential(credentialId, A._)) .Throws(new ServiceException("this is a test", true)); // Act - var result = await _sut.ExecuteProcessStep(ProcessStepTypeId.CREATE_CREDENTIAL, Enumerable.Empty(), CancellationToken.None); + var result = await _sut.ExecuteProcessStep(ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL, Enumerable.Empty(), CancellationToken.None); // Assert result.Modified.Should().BeTrue(); @@ -218,11 +217,11 @@ public async Task ExecuteProcessStep_WithServiceException_ReturnsFailedAndRetrig initializeResult.ScheduleStepTypeIds.Should().BeNull(); // Arrange - A.CallTo(() => _credentialCreationProcessHandler.CreateCredential(credentialId, A._)) + A.CallTo(() => _credentialCreationProcessHandler.CreateSignedCredential(credentialId, A._)) .Throws(new ServiceException("this is a test")); // Act - var result = await _sut.ExecuteProcessStep(ProcessStepTypeId.CREATE_CREDENTIAL, Enumerable.Empty(), CancellationToken.None); + var result = await _sut.ExecuteProcessStep(ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL, Enumerable.Empty(), CancellationToken.None); // Assert result.Modified.Should().BeTrue(); diff --git a/tests/processes/CredentialProcess.Worker.Tests/CredentialExpiryProcessTypeExecutorTests.cs b/tests/processes/CredentialProcess.Worker.Tests/CredentialExpiryProcessTypeExecutorTests.cs index 5fc861fd..3115ccac 100644 --- a/tests/processes/CredentialProcess.Worker.Tests/CredentialExpiryProcessTypeExecutorTests.cs +++ b/tests/processes/CredentialProcess.Worker.Tests/CredentialExpiryProcessTypeExecutorTests.cs @@ -130,7 +130,7 @@ public async Task InitializeProcess_WithNotExistingProcess_ThrowsNotFoundExcepti public async Task ExecuteProcessStep_WithoutRegistrationId_ThrowsUnexpectedConditionException() { // Act - async Task Act() => await _sut.ExecuteProcessStep(ProcessStepTypeId.SIGN_CREDENTIAL, Enumerable.Empty(), CancellationToken.None); + async Task Act() => await _sut.ExecuteProcessStep(ProcessStepTypeId.CREATE_SIGNED_CREDENTIAL, Enumerable.Empty(), CancellationToken.None); // Assert var ex = await Assert.ThrowsAsync(Act);