net.nemerosa.ontrack.model.security.DefaultOntrackAuthenticatedUser.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontrack-model Show documentation
Show all versions of ontrack-model Show documentation
Ontrack module: ontrack-model
package net.nemerosa.ontrack.model.security
import org.springframework.security.core.CredentialsContainer
import org.springframework.security.core.userdetails.UserDetails
class DefaultOntrackAuthenticatedUser(
override val user: OntrackUser,
val authorizedAccount: AuthorizedAccount,
val groups: List
) : OntrackAuthenticatedUser, UserDetails by user, CredentialsContainer {
override val account: Account = authorizedAccount.account
override fun isGranted(fn: Class) =
authorizedAccount.isGranted(fn) || groups.any { it.isGranted(fn) }
override fun isGranted(projectId: Int, fn: Class) =
authorizedAccount.isGranted(projectId, fn) || groups.any { it.isGranted(projectId, fn) }
override fun eraseCredentials() {
if (user is CredentialsContainer) {
user.eraseCredentials()
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy