All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.model.security.AccountOntrackUser.kt Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
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