- 
                Notifications
    
You must be signed in to change notification settings  - Fork 818
 
OpenID: Add claims to Well know #967
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            8 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      74d21d6
              
                OpenID: Claims: Add claims inside well-known
              
              
                AndreaGreco 0edaf30
              
                OpenID: Claims: Additional test in well-know update test
              
              
                AndreaGreco b2591ca
              
                OpenID: Claims: Docs: Add docs wellknow claims
              
              
                AndreaGreco c5aa67e
              
                Merge branch 'master' into master
              
              
                auvipy 06539f8
              
                [pre-commit.ci] auto fixes from pre-commit.com hooks
              
              
                pre-commit-ci[bot] 7a00aee
              
                Merge branch 'master' into master
              
              
                auvipy 5aecfce
              
                Merge branch 'master' into master
              
              
                auvipy 7cdd811
              
                Merge branch 'master' into master
              
              
                Andrew-Chen-Wang File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -60,4 +60,6 @@ Jadiel Teófilo | |
| pySilver | ||
| Łukasz Skarżyński | ||
| Shaheed Haque | ||
| Andrea Greco | ||
| Vinay Karanam | ||
| 
     | 
||
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -29,6 +29,7 @@ def test_get_connect_discovery_info(self): | |
| "subject_types_supported": ["public"], | ||
| "id_token_signing_alg_values_supported": ["RS256", "HS256"], | ||
| "token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"], | ||
| "claims_supported": ["sub"], | ||
| } | ||
| response = self.client.get(reverse("oauth2_provider:oidc-connect-discovery-info")) | ||
| self.assertEqual(response.status_code, 200) | ||
| 
        
          
        
         | 
    @@ -55,6 +56,7 @@ def test_get_connect_discovery_info_without_issuer_url(self): | |
| "subject_types_supported": ["public"], | ||
| "id_token_signing_alg_values_supported": ["RS256", "HS256"], | ||
| "token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"], | ||
| "claims_supported": ["sub"], | ||
| } | ||
| response = self.client.get(reverse("oauth2_provider:oidc-connect-discovery-info")) | ||
| self.assertEqual(response.status_code, 200) | ||
| 
          
            
          
           | 
    @@ -146,11 +148,21 @@ def test_userinfo_endpoint_bad_token(oidc_tokens, client): | |
| assert rsp.status_code == 401 | ||
| 
     | 
||
| 
     | 
||
| EXAMPLE_EMAIL = "[email protected]" | ||
| 
     | 
||
| 
     | 
||
| def claim_user_email(request): | ||
| return EXAMPLE_EMAIL | ||
| 
     | 
||
| 
     | 
||
| @pytest.mark.django_db | ||
| def test_userinfo_endpoint_custom_claims(oidc_tokens, client, oauth2_settings): | ||
| class CustomValidator(OAuth2Validator): | ||
| def get_additional_claims(self, request): | ||
| return {"state": "very nice"} | ||
| def get_additional_claims(self): | ||
| return [ | ||
| ("username", claim_user_email), | ||
| ("email", claim_user_email), | ||
| ] | ||
| 
     | 
||
| oidc_tokens.oauth2_settings.OAUTH2_VALIDATOR_CLASS = CustomValidator | ||
| auth_header = "Bearer %s" % oidc_tokens.access_token | ||
| 
        
          
        
         | 
    @@ -161,5 +173,9 @@ def get_additional_claims(self, request): | |
| data = rsp.json() | ||
| assert "sub" in data | ||
| assert data["sub"] == str(oidc_tokens.user.pk) | ||
| assert "state" in data | ||
| assert data["state"] == "very nice" | ||
| 
     | 
||
| assert "username" in data | ||
| assert data["username"] == EXAMPLE_EMAIL | ||
| 
     | 
||
| assert "email" in data | ||
| assert data["email"] == EXAMPLE_EMAIL | ||
  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.
  
    
  
    
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.
to remove it..
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.
This is StandardClaims, some application use it for discover available params.
My case application is https://docebo.com
As commented inside code:
https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
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.
The remark was about the preposition.