feat: basic authorization model

This commit is contained in:
2023-03-13 10:44:58 +01:00
parent 55db21ad23
commit fa36d55163
28 changed files with 589 additions and 114 deletions

View File

@ -20,8 +20,8 @@ const (
contextKeyUser contextKey = "user"
)
func CtxUser(ctx context.Context) (*User, error) {
user, ok := ctx.Value(contextKeyUser).(*User)
func CtxUser(ctx context.Context) (User, error) {
user, ok := ctx.Value(contextKeyUser).(User)
if !ok {
return nil, errors.Errorf("unexpected user type: expected '%T', got '%T'", new(User), ctx.Value(contextKeyUser))
}

View File

@ -1,4 +1,4 @@
package user
package thirdparty
import (
"context"

View File

@ -1,4 +1,4 @@
package user
package thirdparty
import (
"context"

View File

@ -1,4 +1,4 @@
package user
package thirdparty
import "forge.cadoles.com/Cadoles/emissary/internal/auth"