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

ISSUE: Implement better error handling for the Domain app #24

Open
f-trivino opened this issue Mar 16, 2023 · 1 comment
Open

ISSUE: Implement better error handling for the Domain app #24

f-trivino opened this issue Mar 16, 2023 · 1 comment

Comments

@f-trivino
Copy link
Collaborator

A call to delete a domain with a wrong id does not return any error, IMO it should mention something like "No such domain".

If a wrong client id/password is provided, ipa-client-install fails but this error is not well handled

@justin-stephenson
Copy link
Collaborator

If the client/bridge cannot lookup the IPA server using SRV records, this also creates a failure which cannot be parsed by the keycloak plugin.

Traceback (most recent call last):                                                                                                                                                                                                                                                                                                                                         
  File "/root/ipa-tuura/ipatuura-env/lib64/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner                                                                                                                                                                                                                                                  
    response = get_response(request)                                                                                                                                                                                                                                                                                                                                       
               ^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                                       
  File "/root/ipa-tuura/ipatuura-env/lib64/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response                                                                                                                                                                                                                                              
    response = wrapped_callback(request, *callback_args, **callback_kwargs)                                                                                                                                                                                                                                                                                                
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                
  File "/root/ipa-tuura/ipatuura-env/lib64/python3.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view                                                                                                                                                                                                                                             
    return view_func(*args, **kwargs)                                                                                                                                                                                                                                                                                                                                      
           ^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                
  File "/root/ipa-tuura/ipatuura-env/lib64/python3.11/site-packages/rest_framework/viewsets.py", line 125, in view                                                                   
    return self.dispatch(request, *args, **kwargs)                                                                                                                                                                                                                                                                                                                         
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                         
  File "/root/ipa-tuura/ipatuura-env/lib64/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch                                                                  
    response = self.handle_exception(exc)                                                                                                                                                                                                                                                                                                                                  
               ^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                                  
  File "/root/ipa-tuura/ipatuura-env/lib64/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception                                                                                                                                                                                                                                                
    self.raise_uncaught_exception(exc)                                                                                                                                                                                                                                                                                                                                     
  File "/root/ipa-tuura/ipatuura-env/lib64/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception                                                                                                                                                                                                                                        
    raise exc                                                                                                                                                                                                                                                                                                                                                              
  File "/root/ipa-tuura/ipatuura-env/lib64/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch                                                                                                                                                                                                                                                        
    response = handler(request, *args, **kwargs)                                                                                                                                                                                                                                                                                                                           
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                           
  File "/root/ipa-tuura/src/ipa-tuura/domains/views.py", line 41, in create                                                                                                                                                                                                                                                                                                
    raise e                                                                                                                                                                                                                                                                                                                                                                
  File "/root/ipa-tuura/src/ipa-tuura/domains/views.py", line 39, in create                                                                                                                                                                                                                                                                                                
    add_domain(serializer.validated_data)                                                                                                                                                                                                                                                                                                                                  
  File "/root/ipa-tuura/src/ipa-tuura/domains/utils.py", line 382, in add_domain                                                                                                                                                                                                                                                                                           
    install_client(domain)                                                                                                                                                                                                                                                                                                                                                 
  File "/root/ipa-tuura/src/ipa-tuura/domains/utils.py", line 101, in install_client                                                                                                                                                                                                                                                                                       
    raise Exception("Error enrolling client:\n{}".format(proc.stderr))                                                                                                                                                                                                                                                                                                     
Exception: Error enrolling client:                                                                                                                                                                                                                                                                                                                                         
Unable to find IPA Server to join                                                                                                                                                                                                                                                                                                                                          
The ipa-client-install command failed. See /var/log/ipaclient-install.log for more information     




2023-07-11 09:04:18,819 ERROR [keycloak.scim_user_spi.Scim] (executor-thread-4) Failed to add integration domain: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (StringReader); line: 1, column: 2]                                                                                                                                     
2023-07-11 09:04:18,820 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-4) Uncaught server error: java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')                                
 at [Source: (StringReader); line: 1, column: 2]                                                                                                                                     
        at keycloak.scim_user_spi.Scim.domainsRequest(Scim.java:159)                                                                                                                 
        at keycloak.scim_user_spi.SCIMUserStorageProviderFactory.validateConfiguration(SCIMUserStorageProviderFactory.java:172)                                                      
        at org.keycloak.models.jpa.RealmAdapter.importComponentModel(RealmAdapter.java:2023)                                                                                         
        at org.keycloak.models.jpa.RealmAdapter.addComponentModel(RealmAdapter.java:2003)                                                                                            
        at org.keycloak.models.cache.infinispan.RealmAdapter.addComponentModel(RealmAdapter.java:1556)                                                                               
        at org.keycloak.services.resources.admin.ComponentResource.create(ComponentResource.java:133)                                                                                
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                            
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)                                                                                                                                                                                                                                                                
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                  
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)  

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

No branches or pull requests

2 participants