net.nemerosa.ontrack.model.security.AccountOntrackUser.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 net.nemerosa.ontrack.model.security.Account
import net.nemerosa.ontrack.model.security.OntrackUser
import org.springframework.security.core.GrantedAuthority
import org.springframework.security.core.authority.AuthorityUtils
/**
* [Account] based [OntrackUser].
*/
open class AccountOntrackUser(
private val account: Account
) : OntrackUser {
override val accountId: Int = account.id()
override fun getAuthorities(): Collection = AuthorityUtils.createAuthorityList(account.role.roleName)
override fun isEnabled(): Boolean = !account.disabled
override fun getUsername(): String = account.name
override fun isCredentialsNonExpired(): Boolean = true
override fun getPassword(): String = ""
override fun isAccountNonExpired(): Boolean = true
override fun isAccountNonLocked(): Boolean = true
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy