main.dev.neeffect.nee.security.oauth.OauthConfig.kt Maven / Gradle / Ivy
The newest version!
package dev.neeffect.nee.security.oauth
import io.vavr.collection.HashMap
import io.vavr.collection.Map
import io.vavr.control.Option
data class OauthConfig(
val providers: Map = HashMap.empty()
) {
fun getProviderConfig(ouathProviderName: OauthProviderName): Option =
providers[ouathProviderName.providerName]
fun getClientId(ouathProviderName: OauthProviderName) =
getProviderConfig(ouathProviderName).map { it.clientId }.getOrElseThrow {
IllegalStateException("unconfigured provider: $ouathProviderName")
}
fun getClientSecret(ouathProviderName: OauthProviderName) =
getProviderConfig(ouathProviderName).map { it.clientSecret }.getOrElseThrow {
IllegalStateException("unconfigured provider: $ouathProviderName")
}
}
data class ProviderConfig(
val clientId: String,
val clientSecret: String,
val certificatesFile: Option = Option.none()
)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy