-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBackendConfigurationProperties.kt
More file actions
92 lines (83 loc) · 3.5 KB
/
Copy pathBackendConfigurationProperties.kt
File metadata and controls
92 lines (83 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package at.asitplus.wallet.backend.config
import org.springframework.boot.context.properties.ConfigurationProperties
import java.net.URI
import java.net.URL
import kotlin.time.Duration
@ConfigurationProperties(prefix = "backend")
data class BackendConfigurationProperties(
/** Public URL of this instance, used for several URLs in messages sent to the Wallet. */
val publicContext: URL = URL("http://localhost:8080"),
/** Configuration for issued credentials. */
val credentials: CredentialConfigurationProperties = CredentialConfigurationProperties(),
/** Key used for signing issued credentials. */
val issuerKey: KeyConfiguration = KeyConfiguration(),
/** Optional key used for signing ISO mdoc credentials. Falls back to [issuerKey] when unset. */
val isoMdocIssuerKey: KeyConfiguration? = null,
/** Key used for signing authn requests for PID login */
val verifierKey: KeyConfiguration = KeyConfiguration(),
/** Configure details about revocation lists. */
val revocationList: RevocationListConfigurationProperties = RevocationListConfigurationProperties(),
/** Issuer name for OID4VCI metadata. */
val metadata: MetadataConfiguration = MetadataConfiguration(),
)
data class MetadataConfiguration(
val name: String = "A-SIT Plus Wallet Issuer",
val logo: String = "https://wallet.a-sit.at/assets/images/logo.svg",
)
data class CredentialConfigurationProperties(
/** Lifetime of the credentials issued, defaults to `P7D`. */
private val lifetime: String = "P7D",
) {
//eager evaluation → fail on load
val lifeTime: Duration = Duration.parse(lifetime)
}
data class RevocationListConfigurationProperties(
/** Lifetime of a single revocation list, defaults to `P7D`, i.e. 7 days. */
private val lifetime: String = "P7D",
/** Timeout after which to write revocation lists again, that have not been written recently, defaults to `P5D`. */
private val regularWriteTimeout: String = "P5D",
/**
* Rate at which to check for dirty revocation lists that shall be written after a credential got revoked,
* defaults to `PT10M`.
*/
private val dirtyCheckRate: String = "PT10M",
/**
* Rate at which to check for outdated revocation lists that shall be written again, if nothing changed,
* defaults to `PT1H`.
*/
private val regularCheckRate: String = "PT1H",
/**
* Path at which the revocation lists shall be written to and read from, defaults to `cache/revocation-lists/`
*/
val path: String = "cache/revocation-lists/",
) {
val lifetimeDuration: Duration = Duration.parse(lifetime)
val regularWriteTimeoutDuration: Duration = Duration.parse(regularWriteTimeout)
val dirtyCheckRateDuration: Duration = Duration.parse(dirtyCheckRate)
val regularCheckRateDuration: Duration = Duration.parse(regularCheckRate)
val cwtPath = path.let { if (it.endsWith("/")) it else "$it/" } + "cwt/"
val jwtPath = path.let { if (it.endsWith("/")) it else "$it/" } + "jwt/"
}
data class KeyConfiguration(
val type: KeyType = KeyType.MEMORY,
val file: KeyFileConfiguration? = null,
val keystore: KeyStoreConfiguration? = null,
)
data class KeyFileConfiguration(
val privateKey: URI,
val publicKey: URI?,
val certificate: URI?,
)
data class KeyStoreConfiguration(
val path: URI,
val type: String,
val provider: String? = null,
val password: String? = null,
val alias: String,
val aliasPassword: String? = null,
)
enum class KeyType {
FILE,
MEMORY,
KEYSTORE,
}