-
-
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.
Resolve issues with warden and client api (#120)
* warden: fix firewall settings close #118 * client: do not base64 encode client secrets on http api close #119 * vendor: glide up
- Loading branch information
Aeneas
authored
Jun 26, 2016
1 parent
8ab555d
commit c77d2dc
Showing
16 changed files
with
222 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package client | ||
|
||
import "github.com/ory-am/fosite" | ||
|
||
type Client struct { | ||
ID string `json:"id" gorethink:"id"` | ||
Name string `json:"client_name" gorethink:"client_name"` | ||
Secret string `json:"client_secret,omitempty" gorethink:"client_secret"` | ||
RedirectURIs []string `json:"redirect_uris" gorethink:"redirect_uris"` | ||
GrantTypes []string `json:"grant_types" gorethink:"grant_types"` | ||
ResponseTypes []string `json:"response_types" gorethink:"response_types"` | ||
GrantedScopes []string `json:"granted_scopes" gorethink:"granted_scopes"` | ||
Owner string `json:"owner" gorethink:"owner"` | ||
PolicyURI string `json:"policy_uri" gorethink:"policy_uri"` | ||
TermsOfServiceURI string `json:"tos_uri" gorethink:"tos_uri"` | ||
ClientURI string `json:"client_uri" gorethink:"client_uri"` | ||
LogoURI string `json:"logo_uri" gorethink:"logo_uri"` | ||
Contacts []string `json:"contacts" gorethink:"contacts"` | ||
} | ||
|
||
func (c *Client) GetID() string { | ||
return c.ID | ||
} | ||
|
||
func (c *Client) GetRedirectURIs() []string { | ||
return c.RedirectURIs | ||
} | ||
|
||
func (c *Client) GetHashedSecret() []byte { | ||
return []byte(c.Secret) | ||
} | ||
|
||
func (c *Client) GetGrantedScopes() fosite.Scopes { | ||
return &fosite.DefaultScopes{ | ||
Scopes: c.GrantedScopes, | ||
} | ||
} | ||
|
||
func (c *Client) GetGrantTypes() fosite.Arguments { | ||
// https://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata | ||
// | ||
// JSON array containing a list of the OAuth 2.0 Grant Types that the Client is declaring | ||
// that it will restrict itself to using. | ||
// If omitted, the default is that the Client will use only the authorization_code Grant Type. | ||
if len(c.GrantTypes) == 0 { | ||
return fosite.Arguments{"authorization_code"} | ||
} | ||
return fosite.Arguments(c.GrantTypes) | ||
} | ||
|
||
func (c *Client) GetResponseTypes() fosite.Arguments { | ||
// https://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata | ||
// | ||
// <JSON array containing a list of the OAuth 2.0 response_type values that the Client is declaring | ||
// that it will restrict itself to using. If omitted, the default is that the Client will use | ||
// only the code Response Type. | ||
if len(c.ResponseTypes) == 0 { | ||
return fosite.Arguments{"code"} | ||
} | ||
return fosite.Arguments(c.ResponseTypes) | ||
} | ||
|
||
func (c *Client) GetOwner() string { | ||
return c.Owner | ||
} |
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
Oops, something went wrong.