mirror of
https://github.com/goauthentik/authentik
synced 2026-04-28 02:18:11 +02:00
* packages/client-go: init Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> * remove mod/sum Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix translate Signed-off-by: Jens Langhammer <jens@goauthentik.io> * no go replace Signed-off-by: Jens Langhammer <jens@goauthentik.io> * update rust makefile with pwd Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> * fix build Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix docs Signed-off-by: Jens Langhammer <jens@goauthentik.io> * don't need a version ig? Signed-off-by: Jens Langhammer <jens@goauthentik.io> * exclude go client from cspell Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix main docker build Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
31 lines
564 B
Go
31 lines
564 B
Go
package flags
|
|
|
|
import (
|
|
"crypto/sha256"
|
|
"encoding/hex"
|
|
"net/http"
|
|
|
|
"github.com/golang-jwt/jwt/v5"
|
|
"goauthentik.io/internal/outpost/flow"
|
|
api "goauthentik.io/packages/client-go"
|
|
)
|
|
|
|
const InvalidUserPK = -1
|
|
|
|
type UserFlags struct {
|
|
UserInfo *api.User
|
|
UserPk int32
|
|
CanSearch bool
|
|
Session *http.Cookie
|
|
SessionJWT *jwt.Token
|
|
}
|
|
|
|
func (uf UserFlags) SessionID() string {
|
|
if uf.SessionJWT == nil {
|
|
return ""
|
|
}
|
|
h := sha256.New()
|
|
h.Write([]byte(uf.SessionJWT.Claims.(*flow.SessionCookieClaims).SessionID))
|
|
return hex.EncodeToString(h.Sum(nil))
|
|
}
|