-
Notifications
You must be signed in to change notification settings - Fork 124
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
ONYX-13631 - token-app-property
supports nested claims
#2397
Conversation
0026a2c
to
64e5962
Compare
cucumber/authenticators_jwt/features/authn_jwt_nested_claims.feature
Outdated
Show resolved
Hide resolved
app/domain/authentication/authn_jwt/identity_providers/identity_from_decoded_token_provider.rb
Outdated
Show resolved
Hide resolved
app/domain/authentication/authn_jwt/identity_providers/identity_from_decoded_token_provider.rb
Outdated
Show resolved
Hide resolved
app/domain/authentication/authn_jwt/identity_providers/identity_from_decoded_token_provider.rb
Outdated
Show resolved
Hide resolved
code: "CONJ00117E" | ||
) | ||
|
||
TokenAppPropertyValueIsNotString = ::Util::TrackableErrorClass.new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hilagross @shulifink Please review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any idea why this was failed?
does the error explain the reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Authentication Error: #<Errors::Authentication::AuthnJwt::InvalidTokenAppPropertyValue: CONJ00117E Failed to parse 'token-app-property' value. Error: '#<Errors::Authentication::AuthnJwt::InvalidClaimPath: CONJ00116E Failed to parse claim path: 'account[0]/project/id'. The claim path is in an invalid format. The valid format should meet the following regex: '(?-mix:^[a-zA-Z|$|][a-zA-Z|$||0-9|.](/[a-zA-Z|$|][a-zA-Z|$||0-9|.])*$)'>'>
This is how it will look like, it is clear, thanks @sashaCher
app/domain/errors.rb
Outdated
) | ||
|
||
TokenAppPropertyValueIsNotString = ::Util::TrackableErrorClass.new( | ||
msg: "{0-claim-path} value in token is an {1-type}. Only string value can be an identity.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an? will this always start with a vowel? What are the options?
What does "Only string value can be an identity" mean? DO you mean "An identity must be a string"?
And I am the super-user | ||
And I initialize remote JWKS endpoint with file "authn-jwt-general" and alg "RS256" | ||
And I successfully set authn-jwt "jwks-uri" variable value to "http://jwks_py:8090/authn-jwt-general/RS256" in service "raw" | ||
And I successfully set authn-jwt "token-app-property" variable to value "host" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this from background each test should will have its own value
And I successfully set authn-jwt "token-app-property" variable to value "host" | ||
|
||
@sanity | ||
Scenario: ONYX-????: Token-app-property from nested claim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the test to the feature file of tests for identity from decoded token
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
f72be20
to
2c5e06f
Compare
2c5e06f
to
43546ff
Compare
end | ||
|
||
def id_claim_value_not_empty | ||
return unless id_claim_value.nil? || id_claim_value.empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Authentication::AuthnJwt::IdentityProviders#id_claim_value_not_empty performs a nil-check
claim.nil? || !claim.match?(NESTED_CLAIM_NAME_REGEX) | ||
def call(claim:, parts_separator: PATH_DELIMITER) | ||
raise Errors::Authentication::AuthnJwt::InvalidClaimPath.new(claim, PURE_NESTED_CLAIM_NAME_REGEX) if | ||
claim.nil? || !claim.match?(PURE_NESTED_CLAIM_NAME_REGEX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Authentication::AuthnJwt::ParseClaimPath#call performs a nil-check
app/domain/authentication/authn_jwt/identity_providers/identity_from_decoded_token_provider.rb
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put some comments
cucumber/authenticators_jwt/features/authn_jwt_fetch_identity_decoded_token.feature
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Code Climate has analyzed commit 4848eaa and detected 2 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 90.8% (0.0% change). View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Desired Outcome
token-app-property
supports fetching identity from nested claimsCheck that value fetched using
token-app-property
can be a String onlyImplemented Changes
ParseClaimPath
became a dependency ofIdentityFromDecodedTokenProvider
.IdentityFromDecodedTokenProvider
changed the way it brings value from decoded token: it uses HASH.dig function instead of fetching by index.Connected Issue/Story
Follows design #2394
ONYX-13604
Definition of Done
Changelog
CHANGELOG update
Test coverage
changes, or
Documentation
README
s) were updated in this PRBehavior
Security