Skip to content

Commit

Permalink
update authConfig schema (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
andriisoldatenko authored and schnie committed Jul 16, 2019
1 parent 07cbc0c commit c6f06f0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion auth/auth.go
Expand Up @@ -137,7 +137,7 @@ func Login(domain string, oAuthOnly bool) error {
}

if len(username) == 0 {
if authConfig.GoogleEnabled || authConfig.Auth0Enabled || authConfig.GithubEnabled {
if authConfig.PublicSignup {
token = oAuth(c.GetAppURL() + "/login?source=cli")
} else {
return errors.New("cannot authenticate, oauth is disabled")
Expand Down
11 changes: 7 additions & 4 deletions houston/queries.go
Expand Up @@ -5,10 +5,13 @@ var (
query GetAuthConfig($redirect: String) {
authConfig(redirect: $redirect) {
localEnabled
googleEnabled
githubEnabled
auth0Enabled
googleOAuthUrl
publicSignup
initialSignup
providers {
name
displayName
url
}
}
}`

Expand Down
14 changes: 10 additions & 4 deletions houston/types.go
Expand Up @@ -26,12 +26,18 @@ type Response struct {
Errors []Error `json:"errors,omitempty"`
}

type AuthProvider struct {
Name string `json:"name"`
DisplayName string `json:"displayName"`
Url string `json:"url"`
}

// AuthConfig holds data related to oAuth and basic authentication
type AuthConfig struct {
LocalEnabled bool `json:"localEnabled"`
GoogleEnabled bool `json:"googleEnabled"`
GithubEnabled bool `json:"githubEnabled"`
Auth0Enabled bool `json:"auth0Enabled"`
LocalEnabled bool `json:"localEnabled"`
PublicSignup bool `json:"publicSignup"`
InitialSignup bool `json:"initialSignup"`
AuthProvider []AuthProvider `json:"providers"`
}

type AuthUser struct {
Expand Down

0 comments on commit c6f06f0

Please sign in to comment.