mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
28 lines
575 B
Go
28 lines
575 B
Go
package ctx
|
|
|
|
import "github.com/labstack/echo/v4"
|
|
|
|
type AuthState string
|
|
|
|
const (
|
|
Visitor AuthState = "visitor"
|
|
Authenticated AuthState = "authenticated"
|
|
Expired AuthState = "expired"
|
|
|
|
PendingCredentials AuthState = "pending_credentials"
|
|
PendingAssertion AuthState = "pending_assertion"
|
|
)
|
|
|
|
func (s AuthState) String() string {
|
|
return string(s)
|
|
}
|
|
|
|
func GetAuthState(c echo.Context) AuthState {
|
|
vals := c.Request().Header.Values("Authorization")
|
|
if len(vals) == 0 {
|
|
return Visitor
|
|
}
|
|
s := AuthState(c.Request().Header.Get("Authorization"))
|
|
return s
|
|
}
|