Skip to content

Commit

Permalink
Request hydra.keys scope and fix panic
Browse files Browse the repository at this point in the history
  • Loading branch information
arekkas authored and arekkas committed Nov 19, 2017
1 parent 8f16a9b commit 546b2cf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/serve_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var allCmd = &cobra.Command{
ClientID: viper.GetString("HYDRA_CLIENT_ID"),
ClientSecret: viper.GetString("HYDRA_CLIENT_SECRET"),
EndpointURL: viper.GetString("HYDRA_URL"),
Scopes: []string{"hydra.warden"},
Scopes: []string{"hydra.warden", "hydra.keys.*"},
},
rules: rules, backendURL: viper.GetString("BACKEND_URL"),
cors: parseCorsOptions(""),
Expand All @@ -36,7 +36,7 @@ var allCmd = &cobra.Command{
ClientID: viper.GetString("HYDRA_CLIENT_ID"),
ClientSecret: viper.GetString("HYDRA_CLIENT_SECRET"),
EndpointURL: viper.GetString("HYDRA_URL"),
Scopes: []string{"hydra.warden"},
Scopes: []string{"hydra.warden", "hydra.keys.*"},
},
rules: rules,
address: fmt.Sprintf("%s:%s", viper.GetString("MANAGEMENT_HOST"), viper.GetString("MANAGEMENT_PORT")),
Expand Down
2 changes: 1 addition & 1 deletion cmd/serve_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ HTTP CONTROLS
ClientID: viper.GetString("HYDRA_CLIENT_ID"),
ClientSecret: viper.GetString("HYDRA_CLIENT_SECRET"),
EndpointURL: viper.GetString("HYDRA_URL"),
Scopes: []string{"hydra.warden"},
Scopes: []string{"hydra.warden", "hydra.keys.*"},
},
rules: rules,
address: fmt.Sprintf("%s:%s", viper.GetString("MANAGEMENT_HOST"), viper.GetString("MANAGEMENT_PORT")),
Expand Down
2 changes: 1 addition & 1 deletion cmd/serve_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ OTHER CONTROLS
ClientID: viper.GetString("HYDRA_CLIENT_ID"),
ClientSecret: viper.GetString("HYDRA_CLIENT_SECRET"),
EndpointURL: viper.GetString("HYDRA_URL"),
Scopes: []string{"hydra.warden"},
Scopes: []string{"hydra.warden", "hydra.keys.*"},
},
rules: rules, backendURL: viper.GetString("BACKEND_URL"),
cors: parseCorsOptions(""),
Expand Down
1 change: 1 addition & 0 deletions director/director.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (d *Director) Director(r *http.Request) {
WithFields(map[string]interface{}{"user": access.User, "client_id": access.ClientID, "request_url": r.URL.String()}).
Errorf("Unable to fetch private key for signing JSON Web Token")
*r = *r.WithContext(context.WithValue(r.Context(), requestDenied, &directorError{err: errors.WithStack(err), statusCode: http.StatusInternalServerError}))
return
}

token, err := jwt.NewWithClaims(jwt.SigningMethodRS256, access.ToClaims()).SignedString(privateKey)
Expand Down

0 comments on commit 546b2cf

Please sign in to comment.