Skip to content

Commit a6bf536

Browse files
committed
docs(authorization): some more documentation after review
1 parent ce06948 commit a6bf536

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

authorization/src/main/kotlin/org/modelix/authorization/AuthorizationConfig.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,22 @@ interface IModelixAuthorizationConfig {
8585
var jwkUri: URI?
8686

8787
/**
88-
* The ID of the public key for the RSA signature.
88+
* If set, only this key is allowed to sign tokens, even if the jwkUri provides multiple keys.
8989
*/
90-
@Deprecated("The key ID is supposed to be retrieved from the token")
90+
@Deprecated("Untrusted keys shouldn't even be return by the jwkUri or configured in some other way")
9191
var jwkKeyId: String?
9292

9393
/**
9494
* Defines the available permissions and their relations.
9595
*/
9696
var permissionSchema: Schema
9797

98+
/**
99+
* Via /permissions/manage, users can grant permissions to ID tokens.
100+
* By default, changes are not persisted.
101+
* As an alternative to this configuration option, the environment variable MODELIX_ACCESS_CONTROL_FILE can be used
102+
* to write changes to disk.
103+
*/
98104
var accessControlPersistence: IAccessControlPersistence
99105

100106
/**
@@ -213,7 +219,7 @@ private fun getBooleanFromEnv(name: String): Boolean? {
213219

214220
internal fun ByteArray.repeatBytes(minimumSize: Int): ByteArray {
215221
if (size >= minimumSize) return this
216-
val repeated = ByteArray(((size / 256) + 1) * 256)
222+
val repeated = ByteArray(minimumSize)
217223
for (i in repeated.indices) repeated[i] = this[i % size]
218224
return repeated
219225
}

authorization/src/main/kotlin/org/modelix/authorization/ModelixJWTUtil.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class ModelixJWTUtil {
8787
}
8888

8989
fun addHmacKey(key: String, algorithm: JWSAlgorithm) {
90+
// nimbusds checks for weak keys that are shorter than 256 bytes
9091
addHmacKey(key.toByteArray().ensureMinSecretLength(algorithm), algorithm)
9192
}
9293

0 commit comments

Comments
 (0)