Skip to content

Commit

Permalink
oauth2: refresh token does not migrate session object to new token - c…
Browse files Browse the repository at this point in the history
…loses #283 (#284)
  • Loading branch information
arekkas authored Oct 6, 2016
1 parent 05b5f84 commit 835bb2b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
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

0 comments on commit 835bb2b

Please sign in to comment.