Skip to content

Commit

Permalink
cmd: Add flags for newly introduced oidc client settings
Browse files Browse the repository at this point in the history
Closes #938

Signed-off-by: arekkas <aeneas@ory.am>
  • Loading branch information
arekkas authored and arekkas committed Jul 22, 2018
1 parent 8f71806 commit c4b902d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
28 changes: 19 additions & 9 deletions cmd/cli/handler_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ func (h *ClientHandler) CreateClient(cmd *cobra.Command, args []string) {
name, _ := cmd.Flags().GetString("name")
secret, _ := cmd.Flags().GetString("secret")
id, _ := cmd.Flags().GetString("id")
public, _ := cmd.Flags().GetBool("is-public")
tokenEndpointAuthMethod, _ := cmd.Flags().GetString("token-endpoint-auth-method")
jwksUri, _ := cmd.Flags().GetString("jwks-uri")
tosUri, _ := cmd.Flags().GetString("tos-uri")
policyUri, _ := cmd.Flags().GetString("policy-uri")
logoUri, _ := cmd.Flags().GetString("logo-uri")
clientUri, _ := cmd.Flags().GetString("client-uri")

if secret == "" {
var secretb []byte
Expand All @@ -106,14 +111,19 @@ func (h *ClientHandler) CreateClient(cmd *cobra.Command, args []string) {
}

cc := hydra.OAuth2Client{
ClientId: id,
ClientSecret: secret,
ResponseTypes: responseTypes,
Scope: strings.Join(allowedScopes, " "),
GrantTypes: grantTypes,
RedirectUris: callbacks,
ClientName: name,
Public: public,
ClientId: id,
ClientSecret: secret,
ResponseTypes: responseTypes,
Scope: strings.Join(allowedScopes, " "),
GrantTypes: grantTypes,
RedirectUris: callbacks,
ClientName: name,
TokenEndpointAuthMethod: tokenEndpointAuthMethod,
JwksUri: jwksUri,
TosUri: tosUri,
PolicyUri: policyUri,
LogoUri: logoUri,
ClientUri: clientUri,
}

result, response, err := m.CreateOAuth2Client(cc)
Expand Down
7 changes: 6 additions & 1 deletion cmd/clients_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ func init() {
clientsCreateCmd.Flags().StringSliceP("grant-types", "g", []string{"authorization_code"}, "A list of allowed grant types")
clientsCreateCmd.Flags().StringSliceP("response-types", "r", []string{"code"}, "A list of allowed response types")
clientsCreateCmd.Flags().StringSliceP("scope", "a", []string{""}, "The scope the client is allowed to request")
clientsCreateCmd.Flags().Bool("is-public", false, "Use this flag to create a public client")
clientsCreateCmd.Flags().String("token-endpoint-auth-method", "client_secret_basic", "Define which authentication method the client may use at the Token Endpoint. Valid values are \"client_secret_post\", \"client_secret_basic\", \"private_key_jwt\", and \"none\"")
clientsCreateCmd.Flags().String("jwks-uri", "", "Define the URL where the JSON Web Key Set should be fetched from when performing the \"private_key_jwt\" client authentication method")
clientsCreateCmd.Flags().String("policy-uri", "", "A URL string that points to a human-readable privacy policy document that describes how the deployment organization collects, uses, retains, and discloses personal data")
clientsCreateCmd.Flags().String("tos-uri", "", "A URL string that points to a human-readable terms of service document for the client that describes a contractual relationship between the end-user and the client that the end-user accepts when authorizing the client")
clientsCreateCmd.Flags().String("client-uri", "", "A URL string of a web page providing information about the client")
clientsCreateCmd.Flags().String("logo-uri", "", "A URL string that references a logo for the client")
clientsCreateCmd.Flags().String("secret", "", "Provide the client's secret")
clientsCreateCmd.Flags().StringP("name", "n", "", "The client's name")
}

0 comments on commit c4b902d

Please sign in to comment.