fix config
This commit is contained in:
parent
8742029109
commit
59fb6e047d
3 changed files with 7 additions and 8 deletions
|
@ -27,16 +27,15 @@ type Authenticator interface {
|
|||
}
|
||||
|
||||
type authenticator struct {
|
||||
domain string
|
||||
jwt *jwtauth.JWTAuth
|
||||
cfg *config.Auth
|
||||
jwt *jwtauth.JWTAuth
|
||||
cfg config.Auth
|
||||
}
|
||||
|
||||
// NewAuthenticator creates a new Authenticator with the provided config.
|
||||
func NewAuthenticator(cfg *config.Auth) Authenticator {
|
||||
func NewAuthenticator(cfg config.Auth) Authenticator {
|
||||
return &authenticator{
|
||||
domain: cfg.Domain,
|
||||
jwt: jwtauth.New("HS256", []byte(cfg.JWTSecret), nil),
|
||||
jwt: jwtauth.New("HS256", []byte(cfg.JWTSecret), nil),
|
||||
cfg: cfg,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ func (a *authenticator) routeAuth(w http.ResponseWriter, r *http.Request) {
|
|||
Value: tok,
|
||||
HttpOnly: true,
|
||||
Secure: a.allowInsecureCookie(r),
|
||||
Domain: a.domain,
|
||||
Domain: a.cfg.Domain,
|
||||
})
|
||||
|
||||
jr := struct {
|
||||
|
|
|
@ -30,7 +30,7 @@ func New(cfg *config.Config) (*Server, error) {
|
|||
}
|
||||
|
||||
r := chi.NewRouter()
|
||||
authenticator := auth.NewAuthenticator(&cfg.Auth)
|
||||
authenticator := auth.NewAuthenticator(cfg.Auth)
|
||||
srv := &Server{
|
||||
auth: authenticator,
|
||||
conf: cfg,
|
||||
|
|
Loading…
Reference in a new issue