Skip to content

Commit

Permalink
all: resolve issues with the sdk and cli, set scopes in token user cmd (
Browse files Browse the repository at this point in the history
#142)

* closes #141
* closes #137
* closes #138
  • Loading branch information
Aeneas authored Jul 14, 2016
1 parent 1e48e18 commit b8673b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/server/handler_connection_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ func newConnectionHandler(c *config.Config, router *httprouter.Router) *connecti
h.Manager = connection.NewMemoryManager()
break
case *config.RethinkDBConnection:
con.CreateTableIfNotExists("hydra_policies")
con.CreateTableIfNotExists("hydra_connections")
m := &connection.RethinkManager{
Session: con.GetSession(),
Table: r.Table("hydra_policies"),
Table: r.Table("hydra_connections"),
}
if err := m.ColdStart(); err != nil {
logrus.Fatalf("Could not fetch initial state: %s", err)
Expand Down
4 changes: 3 additions & 1 deletion cmd/token_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ var tokenUserCmd = &cobra.Command{
}})
}

scopes, _ := cmd.Flags().GetStringSlice("scopes")
conf := oauth2.Config{
ClientID: c.ClientID,
ClientSecret: c.ClientSecret,
Endpoint: oauth2.Endpoint{
TokenURL: pkg.JoinURLStrings(c.ClusterURL, "/oauth2/token"),
AuthURL: pkg.JoinURLStrings(c.ClusterURL, "/oauth2/auth"),
},
Scopes: []string{"core", "hydra", "offline", "openid"},
Scopes: scopes,
}

state, err := sequence.RuneSequence(24, []rune("abcdefghijklmnopqrstuvwxyz"))
Expand Down Expand Up @@ -106,4 +107,5 @@ var tokenUserCmd = &cobra.Command{
func init() {
tokenCmd.AddCommand(tokenUserCmd)
tokenUserCmd.Flags().Bool("no-open", false, "Do not open a browser window with the authorize url")
tokenUserCmd.Flags().StringSlice("scopes", []string{"core", "hydra", "offline", "openid"}, "Ask for specific scopes")
}
3 changes: 2 additions & 1 deletion sdk/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ func Connect(opts ...option) (*Client, error) {
}

c.Warden = &warden.HTTPWarden{
Client: c.http,
Client: c.http,
Endpoint: c.clusterURL,
}

return c, nil
Expand Down

0 comments on commit b8673b7

Please sign in to comment.