-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aeneas Rekkas (arekkas)
committed
May 18, 2016
1 parent
a94481a
commit 3faf695
Showing
15 changed files
with
168 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
package cli | ||
|
||
import ( | ||
"github.com/ory-am/hydra/client" | ||
"github.com/ory-am/hydra/config" | ||
"github.com/ory-am/hydra/connection" | ||
"github.com/ory-am/hydra/policy" | ||
) | ||
|
||
type Handler struct { | ||
Clients *client.CLIHandler | ||
Connections *connection.CLIHandler | ||
Policies *policy.CLIHandler | ||
Keys *CLIHandler | ||
Clients *ClientHandler | ||
Connections *ConnectionHandler | ||
Policies *PolicyHandler | ||
Keys *JWKHandler | ||
} | ||
|
||
func NewHandler(c *config.Config) *Handler { | ||
return &Handler{ | ||
Clients: client.NewCLIHandler(c), | ||
Connections: connection.NewCLIHandler(c), | ||
Policies: policy.NewCLIHandler(c), | ||
Keys: newJWKCLIHandler(c), | ||
Clients: newClientHandler(c), | ||
Connections: newConnectionHandler(c), | ||
Policies: newPolicHandler(c), | ||
Keys: newJWKHandler(c), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package server | ||
|
||
import ( | ||
"github.com/julienschmidt/httprouter" | ||
"github.com/ory-am/fosite" | ||
"github.com/ory-am/hydra/config" | ||
"github.com/ory-am/hydra/herodot" | ||
"github.com/ory-am/hydra/client" | ||
) | ||
|
||
func newClientManager(c *config.Config) client.Manager { | ||
ctx := c.Context() | ||
|
||
switch ctx.Connection.(type) { | ||
case *config.MemoryConnection: | ||
return &client.MemoryManager{ | ||
Clients: map[string]*fosite.DefaultClient{}, | ||
Hasher: ctx.Hasher, | ||
} | ||
default: | ||
panic("Unknown connection type.") | ||
} | ||
} | ||
|
||
func newClientHandler(c *config.Config, router *httprouter.Router, manager client.Manager) *client.Handler { | ||
ctx := c.Context() | ||
h := &client.Handler{ | ||
H: &herodot.JSON{}, | ||
W: ctx.Warden, Manager: manager, | ||
} | ||
|
||
h.SetRoutes(router) | ||
return h | ||
} |
Oops, something went wrong.