- 
                Notifications
    You must be signed in to change notification settings 
- Fork 344
feat(auth): enables OIDC auth code flow #549
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 13 commits
      Commits
    
    
            Show all changes
          
          
            16 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      fd79c1b
              
                fix(auth): Enable OIDC auth code flow
              
              
                 226f36b
              
                fix(auth): Enable OIDC auth code flow
              
              
                 956b3cd
              
                removing unintended file
              
              
                 630034a
              
                Merge branch 'master' into code-flow
              
              
                ScruffyProdigy 2e4de12
              
                Changes requested by hiranya911
              
              
                 d30726d
              
                Changes requested by hiranya911
              
              
                 8f3ba5e
              
                Merge branch 'code-flow' of https://github.com/ScruffyProdigy/firebas…
              
              
                 5788a71
              
                Changes requested by hiranya911
              
              
                 eff5dd6
              
                Merge branch 'codeflow' into code-flow
              
              
                 3478ab5
              
                Merge branch 'master' into code-flow
              
              
                ScruffyProdigy 1644b15
              
                Changes requested by Hiranya
              
              
                 f090006
              
                Merge branch 'master' into code-flow
              
              
                hiranya911 15c69bc
              
                Linting errors
              
              
                 93ff944
              
                Linting Errors
              
              
                 5d021c6
              
                Linting Errors
              
              
                 df4a0f1
              
                Changes requested by kevinthecheung@
              
              
                 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
    
  
  
    
              
  
    
      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 | 
|---|---|---|
|  | @@ -79,13 +79,21 @@ class TestOIDCProviderConfig: | |
| 'issuer': 'https://oidc.com/issuer', | ||
| 'display_name': 'oidcProviderName', | ||
| 'enabled': True, | ||
| 'id_token_response_type': True, | ||
| 'code_response_type': True, | ||
| 'client_secret': 'CLIENT_SECRET', | ||
| } | ||
|  | ||
| OIDC_CONFIG_REQUEST = { | ||
| 'displayName': 'oidcProviderName', | ||
| 'enabled': True, | ||
| 'clientId': 'CLIENT_ID', | ||
| 'clientSecret': 'CLIENT_SECRET', | ||
| 'issuer': 'https://oidc.com/issuer', | ||
| 'responseType': { | ||
| 'code': True, | ||
| 'idToken': True, | ||
| }, | ||
| } | ||
|  | ||
| @pytest.mark.parametrize('provider_id', INVALID_PROVIDER_IDS + ['saml.provider']) | ||
|  | @@ -112,6 +120,10 @@ def test_get(self, user_mgt_app): | |
| {'issuer': None}, {'issuer': ''}, {'issuer': 'not a url'}, | ||
| {'display_name': True}, | ||
| {'enabled': 'true'}, | ||
| {'id_token_response_type': 'true'}, {'code_response_type': 'true'}, | ||
| {'code_response_type': True, 'client_secret': ''}, {'code_response_type': True, 'client_secret': True}, | ||
| {'code_response_type': True, 'client_secret': None}, | ||
|         
                  hiranya911 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| {'code_response_type': False, 'id_token_response_type': False}, | ||
| ]) | ||
| def test_create_invalid_args(self, user_mgt_app, invalid_opts): | ||
| options = dict(self.VALID_CREATE_OPTIONS) | ||
|  | @@ -139,9 +151,14 @@ def test_create_minimal(self, user_mgt_app): | |
| options = dict(self.VALID_CREATE_OPTIONS) | ||
| del options['display_name'] | ||
| del options['enabled'] | ||
| del options['client_secret'] | ||
| del options['id_token_response_type'] | ||
| del options['code_response_type'] | ||
| want = dict(self.OIDC_CONFIG_REQUEST) | ||
| del want['displayName'] | ||
| del want['enabled'] | ||
| del want['clientSecret'] | ||
| del want['responseType'] | ||
|  | ||
| provider_config = auth.create_oidc_provider_config(**options, app=user_mgt_app) | ||
|  | ||
|  | @@ -159,9 +176,15 @@ def test_create_empty_values(self, user_mgt_app): | |
| options = dict(self.VALID_CREATE_OPTIONS) | ||
| options['display_name'] = '' | ||
| options['enabled'] = False | ||
| options['code_response_type'] = False | ||
| want = dict(self.OIDC_CONFIG_REQUEST) | ||
| want['displayName'] = '' | ||
| want['enabled'] = False | ||
| want['responseType'] = { | ||
| 'code': False, | ||
| 'idToken': True, | ||
| } | ||
| del want['clientSecret'] | ||
|  | ||
| provider_config = auth.create_oidc_provider_config(**options, app=user_mgt_app) | ||
|  | ||
|  | @@ -181,6 +204,10 @@ def test_create_empty_values(self, user_mgt_app): | |
| {'issuer': ''}, {'issuer': 'not a url'}, | ||
| {'display_name': True}, | ||
| {'enabled': 'true'}, | ||
| {'id_token_response_type': 'true'}, {'code_response_type': 'true'}, | ||
| {'code_response_type': True, 'client_secret': ''}, {'code_response_type': True, 'client_secret': True}, | ||
| {'code_response_type': True, 'client_secret': None}, | ||
| {'code_response_type': False, 'id_token_response_type': False}, | ||
| ]) | ||
| def test_update_invalid_args(self, user_mgt_app, invalid_opts): | ||
| options = {'provider_id': 'oidc.provider'} | ||
|  | @@ -198,7 +225,7 @@ def test_update(self, user_mgt_app): | |
| assert len(recorder) == 1 | ||
| req = recorder[0] | ||
| assert req.method == 'PATCH' | ||
| mask = ['clientId', 'displayName', 'enabled', 'issuer'] | ||
| mask = ['clientId', 'clientSecret', 'displayName', 'enabled', 'issuer', 'responseType.code', 'responseType.idToken'] | ||
|          | ||
| assert req.url == '{0}/oauthIdpConfigs/oidc.provider?updateMask={1}'.format( | ||
| USER_MGT_URLS['PREFIX'], ','.join(mask)) | ||
| got = json.loads(req.body.decode()) | ||
|  | @@ -223,17 +250,17 @@ def test_update_empty_values(self, user_mgt_app): | |
| recorder = _instrument_provider_mgt(user_mgt_app, 200, OIDC_PROVIDER_CONFIG_RESPONSE) | ||
|  | ||
| provider_config = auth.update_oidc_provider_config( | ||
| 'oidc.provider', display_name=auth.DELETE_ATTRIBUTE, enabled=False, app=user_mgt_app) | ||
| 'oidc.provider', display_name=auth.DELETE_ATTRIBUTE, enabled=False, id_token_response_type=False, app=user_mgt_app) | ||
|  | ||
| self._assert_provider_config(provider_config) | ||
| assert len(recorder) == 1 | ||
| req = recorder[0] | ||
| assert req.method == 'PATCH' | ||
| mask = ['displayName', 'enabled'] | ||
| mask = ['displayName', 'enabled', 'responseType.idToken'] | ||
| assert req.url == '{0}/oauthIdpConfigs/oidc.provider?updateMask={1}'.format( | ||
| USER_MGT_URLS['PREFIX'], ','.join(mask)) | ||
| got = json.loads(req.body.decode()) | ||
| assert got == {'displayName': None, 'enabled': False} | ||
| assert got == {'displayName': None, 'enabled': False, 'responseType': {'idToken': False}} | ||
|  | ||
| @pytest.mark.parametrize('provider_id', INVALID_PROVIDER_IDS + ['saml.provider']) | ||
| def test_delete_invalid_provider_id(self, user_mgt_app, provider_id): | ||
|  | ||
  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.
Is this a boolean?
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.
Yes. Fixed