Repository navigation
Add cryptographic Challenge-Response authentication and grant type - #31
Merged
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a cryptographic Challenge-Response authentication mechanism and custom OAuth2 grant type (
challenge_responseandurn:ietf:params:oauth:grant-type:challenge) inAuthly.Key Changes
POST /oauth/challenge):AuthorizableClientand accepts optional identifiers (username,owner_id,key_id).challenge) andchallenge_idusingRandom::Secure.Authly::ChallengeStorewith a configurable TTL (config.challenge_ttl = 60.seconds) and returns{"challenge_id": "...", "challenge": "...", "expires_in": 60}.Authly::Challenge,Authly::ChallengeStore,Authly::InMemoryChallengeStore):store,fetch, atomic single-useconsume!/record_attempt!,delete, and automatic + explicitcleanup_expiredsweeping.POST /oauth/token):grant_type=challenge_responseandgrant_type=urn:ietf:params:oauth:grant-type:challenge.verify_challenge_response?hooks toAuthorizableOwner(Owners) andAuthorizableClient(Clients).Crypto::Subtle.constant_time_compare) and asymmetric Ed25519, RSA (PKCS#1 v1.5 & RSA-PSS), and ECDSA (DER & IEEE P1363 rawr || s) verification viaAuthly::ChallengeVerifier.TokenStrategy(:jwtor:opaque).Authly::Error.expired_challenge(400 expired_challenge) andAuthly::Error.invalid_client(401 invalid_client).Verification
crystal spec(617 examples, 0 failures, 0 errors)ameba(111 files inspected, 0 failures)crystal tool format --check src spec