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

PT-1 ability to generate provisioning urls #1

Merged
merged 9 commits into from
Apr 22, 2022

Conversation

darrenedale
Copy link
Owner

@darrenedale darrenedale commented Apr 22, 2022

Added UrlGenerator class to ... generate URLs

  • UrlGenerator class generates URLs of the form:
      otpauth://totp/[{issuer}:]{user}/?secret={secret}[&digits={digits}][&algorithm={algorithm}][&period={period}][&issuer={issuer}]
  • user and secret are mandatory
  • Url generator can be configured to:
      - show digits always/never/only when set to non-default
      - show period always/never/only when set to non-default
      - show algorithm always/never/only when set to non-default
      - have or not have an issuer
  • updated README.md to include examples of provisioning using the UrlGenerator
  • added exceptions (and common base class) for situations where an UrlGenerator is given incompatible data to work with:
      - InvalidUserException is thrown when an empty user is given to an UrlGenerator instance or when an attempt is made to generate the URL without first having set the user
      - UnsupportedRendererException is thrown when the digits URL parameter is set to always be generated but the Totp renderer is not an IntegerRenderer
  • added unit tests for UrlGenerator with full coverage
  • added test-time exceptions to report problems with defined test data
  • added constraint to test equivalence of generated URLs (in essence it allows for different ordering of URL parameters as long as the parameters and values themselves are identical

Darren Edale added 9 commits April 19, 2022 11:47
- added UrlGenerator class
- added UrlGeneratorException exception base class
- added InvalidRendererException to be thrown when the UrlGenerator is configured to emit the number of digits but
  the renderer is not an IntegerRenderer
- added UrlGenerator class
- added UrlGeneratorException exception base class
- added InvalidRendererException to be thrown when the UrlGenerator is configured to emit the number of digits but
  the renderer is not an IntegerRenderer
- added helper to generate anonymous Stringable objects with specified strings
- updated existing unit tests to use the helper to create Stringables rather than repeating boilerplate
- renamed EightDigitTest for consistency and correct naming convention
- all unit tests declare strict_types=1
- updated namespace for unit tests.
- added testsuite for renderers.
- moved all test code that is not a test case (e.g. constraints, test case base class) into ...\Framework namespace for clearer separation
- UrlGenerator class generates URLs of the form:
  otpauth://totp/[{issuer}:]{user}/?secret={secret}[&digits={digits}][&algorithm={algorithm}][&period={period}][&issuer={issuer}]
- user and secret are mandatory
- Url generator can be configured to:
  - show digits always/never/only when set to non-default
  - show period always/never/only when set to non-default
  - show algorithm always/never/only when set to non-default
  - have or not have an issuer
- updated README.md to include examples of provisioning using the UrlGenerator
- added exceptions (and common base class) for situations where an UrlGenerator is given incompatible data to work with:
  - InvalidUserException is thrown when an empty user is given to an UrlGenerator instance or when an attempt is made to generate the URL without first having set the user
  - UnsupportedRendererException is thrown when the digits URL parameter is set to always be generated but the Totp renderer is not an IntegerRenderer
- added unit tests for UrlGenerator with full coverage
- added test-time exceptions to report problems with defined test data
- added constraint to test equivalence of generated URLs (in essence it allows for different ordering of URL parameters as long as the parameters and values themselves are identical
…oning-ur-ls' into PT-1-ability-to-generate-provisioning-ur-ls

# Conflicts:
#	src/UrlGenerator.php
- removed redundant InvalidRendererException (the actual exception class is UnsupportedRendererException).- removed redundant UrlGeneratorException (the actual exception class is in the Exceptions/UrlGenerator/ subdirectory).
- added class docs where missing for UrlGenerator exceptions
- added docs for EquivalentOtpAuthUrl constraint
- added class docs for TestCase base class
- added class docs for Integer-based Renderer test cases.
- several files missing newline at end of file
- switched out tab characters for spaces in some files
@darrenedale darrenedale merged commit 2b05018 into main Apr 22, 2022
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

Successfully merging this pull request may close these issues.

None yet

1 participant