zendframework / zend-expressive-authentication-oauth2

OAuth2 (server) authentication middleware for PSR-7 applications.
BSD 3-Clause "New" or "Revised" License
35 stars 20 forks source link

Script to generate keys writes to vendor dir #35

Closed marcguyer closed 5 years ago

marcguyer commented 6 years ago

Provide a narrative description of what you are trying to accomplish.

Code to reproduce the issue

  1. Create a project
    $ composer create-project zendframework/zend-expressive-skeleton oauth2-test
  2. Add zendframework/zend-expressive-authentication-oauth2 as a dependency
    $ cd oauth2-test
    $ composer require zendframework/zend-expressive-authentication-oauth2 dev-master
  3. Run the repo's generate-keys bin script per the installation docs:
    $ php vendor/bin/generate-keys.php
    Could not open input file: vendor/bin/generate-keys.php

    ... where is it?

    $ find . -name '*generate-keys*'
    ./vendor/zendframework/zend-expressive-authentication-oauth2/bin/generate-keys.php

    ... try this:

    $ ./vendor/zendframework/zend-expressive-authentication-oauth2/bin/generate-keys.php
    -bash: ./vendor/zendframework/zend-expressive-authentication-oauth2/bin/generate-keys.php: Permission denied

    ... it's not executable, so:

    $ php vendor/zendframework/zend-expressive-authentication-oauth2/bin/generate-keys.php
    Private key stored in:
    /Users/marcguyer/Documents/dev/marcguyer/oauth2-test/vendor/zendframework/zend-expressive-authentication-oauth2/data/private.key
    Public key stored in:
    /Users/marcguyer/Documents/dev/marcguyer/oauth2-test/vendor/zendframework/zend-expressive-authentication-oauth2/data/public.key
    Encryption key stored in:
    /Users/marcguyer/Documents/dev/marcguyer/oauth2-test/vendor/zendframework/zend-expressive-authentication-oauth2/data/encryption.key

    ... so that worked but placed the keys in vendor dir. Let's try running it with composer:

    $ composer --working-dir=vendor/zendframework/zend-expressive-authentication-oauth2/ generate-keys
    > php bin/generate-keys.php
    Private key stored in:
    /Users/marcguyer/Documents/dev/marcguyer/oauth2-test/vendor/zendframework/zend-expressive-authentication-oauth2/data/private.key
    Public key stored in:
    /Users/marcguyer/Documents/dev/marcguyer/oauth2-test/vendor/zendframework/zend-expressive-authentication-oauth2/data/public.key
    Encryption key stored in:
    /Users/marcguyer/Documents/dev/marcguyer/oauth2-test/vendor/zendframework/zend-expressive-authentication-oauth2/data/encryption.key

    ... same result

Expected results

Keys are expected to be written to the data dir of the parent application (./data). Ideally, I'd like to see it in a namespaced dir in ./data... e.g., ./data/zend-expressive-authentication-oauth2/

Actual results

Keys are written to vendor/zendframework/zend-expressive-authentication-oauth2/data/

/see #3 for a related issue

marcguyer commented 5 years ago

Closed via #37