cleaned up old references i forgot
Dieser Commit ist enthalten in:
Ursprung
c22cb74864
Commit
06a237dd53
|
@ -9,14 +9,14 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
"github.com/phuslu/log"
|
||||
"go.sebtobie.de/httpserver"
|
||||
"go.sebtobie.de/httpserver/auth"
|
||||
"gopkg.in/dgrijalva/jwt-go.v3"
|
||||
)
|
||||
|
||||
var defaccount = &account{
|
||||
data: map[string]interface{}{
|
||||
httpserver.AccountID: "",
|
||||
httpserver.AccountAnon: true,
|
||||
auth.AccountID: "",
|
||||
auth.AccountAnon: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ func maptoarray(m map[string]interface{}) (output []interface{}) {
|
|||
}
|
||||
|
||||
// Account returns the Account representation of the user
|
||||
func (s *SAML) Account(c *gin.Context) httpserver.Account {
|
||||
func (s *SAML) Account(c *gin.Context) auth.Account {
|
||||
acc := &(*defaccount)
|
||||
acc.s = s
|
||||
cookie, err := c.Cookie(s.Cookiename)
|
||||
|
@ -66,14 +66,14 @@ type account struct {
|
|||
}
|
||||
|
||||
func (a *account) Anonymous() bool {
|
||||
return a.data[httpserver.AccountAnon].(bool)
|
||||
return a.data[auth.AccountAnon].(bool)
|
||||
}
|
||||
|
||||
func (a *account) Redirect(c *gin.Context) {
|
||||
id := uuid.New().String()
|
||||
tokenstring, err := jwttoken(jwt.MapClaims{
|
||||
httpserver.AccountID: id,
|
||||
httpserver.AccountAnon: true,
|
||||
auth.AccountID: id,
|
||||
auth.AccountAnon: true,
|
||||
}, a.s.jwtprivatekey)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("Failed to generate the token")
|
||||
|
|
|
@ -14,16 +14,10 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
"github.com/pelletier/go-toml"
|
||||
"github.com/phuslu/log"
|
||||
"go.sebtobie.de/httpserver"
|
||||
"go.sebtobie.de/httpserver/auth"
|
||||
"gopkg.in/dgrijalva/jwt-go.v3"
|
||||
)
|
||||
|
||||
const (
|
||||
HJWT = "jwt"
|
||||
HSPPrivate = "sppriv"
|
||||
HSPPublic = "sppub"
|
||||
)
|
||||
|
||||
var (
|
||||
defaultsaml = &SAML{
|
||||
Selfsigned: false,
|
||||
|
@ -141,7 +135,7 @@ func (s *SAML) metadataHF(c *gin.Context) {
|
|||
}
|
||||
|
||||
func (s *SAML) acsHF(c *gin.Context) {
|
||||
account := c.MustGet("account").(httpserver.Account)
|
||||
account := c.MustGet("account").(auth.Account)
|
||||
err := c.Request.ParseForm()
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusNotAcceptable, err)
|
||||
|
@ -158,9 +152,9 @@ func (s *SAML) acsHF(c *gin.Context) {
|
|||
}
|
||||
data := attributeStatementstomap(assert.AttributeStatements)
|
||||
token, err := jwttoken(jwt.MapClaims{
|
||||
httpserver.AccountAnon: false,
|
||||
httpserver.AccountID: account.Get(httpserver.AccountID).(string),
|
||||
httpserver.AccountUser: data["uid"][0],
|
||||
auth.AccountAnon: false,
|
||||
auth.AccountID: account.Get(auth.AccountID).(string),
|
||||
auth.AccountUser: data["uid"][0],
|
||||
}, s.jwtprivatekey)
|
||||
if err != nil {
|
||||
c.AbortWithStatus(http.StatusInternalServerError)
|
||||
|
|
Laden…
In neuem Issue referenzieren