Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oauth2: refresh token does not migrate session object to new token #284

Merged
merged 1 commit into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions cmd/cli/handler_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (h *PolicyHandler) AddActionToPolicy(cmd *cobra.Command, args []string) {
return
}

policy, err := h.M.Get(args[0])
p, err := h.M.Get(args[0])
pkg.Must(err, "Could not get policy: %s", err)

err = h.M.Delete(args[0])
Expand All @@ -171,16 +171,16 @@ func (h *PolicyHandler) AddActionToPolicy(cmd *cobra.Command, args []string) {
pkg.Must(err, "Could not prepare policy for update: %s", err)
}

p := policy.(*ladon.DefaultPolicy)
p.Actions = append(p.Actions, args[1:]...)
encp := p.(*ladon.DefaultPolicy)
encp.Actions = append(encp.Actions, args[1:]...)

err = h.M.Create(policy)
err = h.M.Create(p)
if h.M.Dry {
fmt.Printf("%s\n", err)
return
}
pkg.Must(err, "Could not update policy: %s", err)
fmt.Printf("Added actions to policy %s", p.ID)
fmt.Printf("Added actions to policy %s", encp.ID)
}

func (h *PolicyHandler) RemoveActionFromPolicy(cmd *cobra.Command, args []string) {
Expand All @@ -197,16 +197,16 @@ func (h *PolicyHandler) GetPolicy(cmd *cobra.Command, args []string) {
return
}

policy, err := h.M.Get(args[0])
p, err := h.M.Get(args[0])
if h.M.Dry {
fmt.Printf("%s\n", err)
return
}
pkg.Must(err, "Could not delete policy: %s", err)

out, err := json.MarshalIndent(policy, "", "\t")
pkg.Must(err, "Could not retrieve policy: %s", err)

out, err := json.MarshalIndent(p, "", "\t")
pkg.Must(err, "Could not convert policy to JSON: %s", err)

fmt.Printf("%s\n", out)
}

Expand All @@ -229,4 +229,4 @@ func (h *PolicyHandler) DeletePolicy(cmd *cobra.Command, args []string) {
pkg.Must(err, "Could not delete policy: %s", err)
fmt.Printf("Connection %s deleted.\n", arg)
}
}
}
5 changes: 1 addition & 4 deletions docs/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ We will use a dummy password as the system secret: `SYSTEM_SECRET=passwordtutori
```
$ go get github.com/ory-am/hydra
$ cd $GOPATH/src/github.com/ory-am/hydra
$ docker-compose build
Building hydra
[...]
$ SYSTEM_SECRET=passwordtutorial DOCKER_IP=localhost docker-compose up
$ SYSTEM_SECRET=passwordtutorial DOCKER_IP=localhost docker-compose up --build
Starting hydra_rethinkdb_1
[...]
mhydra | mtime="2016-05-17T18:09:28Z" level=warning msg="Generated system secret: MnjFP5eLIr60h?hLI1h-!<4(TlWjAHX7"
Expand Down
6 changes: 3 additions & 3 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import:
- package: github.com/dgrijalva/jwt-go
version: ~3.0.0
- package: github.com/ory-am/fosite
version: ~0.3.2
version: ~0.3.5
subpackages:
- compose
- fosite-example/pkg
Expand Down