feat/authentication
+ moved pkg/auth-helper to internal/lib/auth + update AuthInfo + cleaning
This commit is contained in:
No files matched your search
@@ -0,0 +1,15 @@
|
||||
package authhelper
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetAuthInfo(r *http.Request) (*AuthInfo, error) {
|
||||
ctxVal := r.Context().Value(AuthKey{})
|
||||
if ctxVal == nil {
|
||||
return nil, errors.New("can't get auth info")
|
||||
}
|
||||
authInfo := ctxVal.(*AuthInfo)
|
||||
return authInfo, nil
|
||||
}
|
||||
Reference in New Issue
Block a user