Files
simrsx-be/internal/lib/auth/auth.go
Munawwirul Jamal 2c432a7bef feat/authentication
+ moved pkg/auth-helper to internal/lib/auth
+ update AuthInfo
+ cleaning
2025-10-26 21:29:53 +07:00

16 lines
276 B
Go

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
}