package com.cclotus.register

import com.cclotus.register.util.ValidityUtil
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.validation.annotation.Validated
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern

@ConfigurationProperties(prefix = "gaf.auth")
@Validated
class GafAuthConfigure {
    @NotNull
    var jwtSecret: String? = ""

    var jwtIssuer: String? = "gaf"

    @Pattern(regexp = ValidityUtil.VALIDITY_REGEXP)
    var jwtValidity: String? = "8h"

    val jwtValiditySec: Long get() = ValidityUtil.parseValidity(jwtValidity)

}
