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

swagger: scope pattern requires a space #661

Closed
pnicolcev-tulipretail opened this issue Nov 24, 2017 · 2 comments
Closed

swagger: scope pattern requires a space #661

pnicolcev-tulipretail opened this issue Nov 24, 2017 · 2 comments
Milestone

Comments

@pnicolcev-tulipretail
Copy link
Contributor

The pattern definition for scope in the client requires a space after each scope. This is causing problems when generating a client that checks against this pattern.

https://github.com/ory/hydra/blob/master/client/client.go#L57

I've generated a PHP client and so far it works, but when creating a client I get errors when the scope is returned.

For reference, the generated code:

     /**
      * Sets scope
      * @param string $scope Scope is a string containing a space-separated list of scope values (as described in Section 3.3 of OAuth 2.0 [RFC6749]) that the client can use when    requesting access tokens.
      * @return $this
      */
     public function setScope($scope)
     {

         if (!is_null($scope) && (!preg_match("/([a-zA-Z0-9\\.\\*]+\\s)+/", $scope))) {
             throw new \InvalidArgumentException("invalid value for $scope when calling OAuth2Client., must conform to the pattern /([a-zA-Z0-9\\.\\*]+\\s)+/.");
         }

         $this->container['scope'] = $scope;

         return $this;
     }

Changing it to /([a-zA-Z0-9\\.\\*]+\\s?)+/ resolves the issue.

Am I reading this correctly? Want a PR?

@aeneasr
Copy link
Member

aeneasr commented Nov 26, 2017

Ah yes, because if only one scope is allowed, that won't match. Feel free to create a PR!

@aeneasr aeneasr added the docs label Nov 26, 2017
@aeneasr aeneasr added this to the 0.10.0 milestone Nov 26, 2017
pnicolcev-tulipretail added a commit to pnicolcev-tulipretail/hydra that referenced this issue Nov 28, 2017
Signed-off-by: Philip Nicolcev <phil.nicolcev@tulip.io>
aeneasr pushed a commit that referenced this issue Dec 6, 2017
Signed-off-by: Philip Nicolcev <phil.nicolcev@tulip.io>
@aeneasr
Copy link
Member

aeneasr commented Dec 7, 2017

This is resolved now

@aeneasr aeneasr closed this as completed Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants