Skip to content

Commit 79b02db

Browse files
committed
add configuration for roles
1 parent 4c7c542 commit 79b02db

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

api/github.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ func (gh *GitHubGateway) authenticate(w http.ResponseWriter, r *http.Request) er
101101
return errors.New("Access to endpoint not allowed: this part of GitHub's API has been restricted")
102102
}
103103

104+
if len(adminRoles) == 0 {
105+
return nil
106+
}
107+
104108
roles, ok := claims.AppMetaData["roles"]
105109
if ok {
106110
roleStrings, _ := roles.([]interface{})

conf/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type GlobalConfiguration struct {
4545
type Configuration struct {
4646
JWT JWTConfiguration `json:"jwt"`
4747
GitHub GitHubConfig `envconfig:"GITHUB" json:"github"`
48+
Roles []string `envconfig:"ROLES" json:"roles"`
4849
}
4950

5051
func loadEnvironment(filename string) error {

0 commit comments

Comments
 (0)