Summit-Sync / backend

0 stars 0 forks source link

Nach dem ISSUE #60 Erstellung fortführen führt zu Keycloak "User exists with same username" error #61

Open Flavia-de-Luce opened 5 months ago

Flavia-de-Luce commented 5 months ago

image image

api-1 | 2024-06-11T07:55:25.105Z DEBUG 1 --- [nio-8080-exec-9] o.s.security.web.FilterChainProxy : Securing OPTIONS /api/v1/course api-1 | 2024-06-11T07:55:25.109Z DEBUG 1 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : Securing POST /api/v1/course api-1 | 2024-06-11T07:55:25.110Z DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.RestTemplate : HTTP GET https://keycloak.summitsync.meschter.me/realms/summit-sync/protocol/openid-connect/certs api-1 | 2024-06-11T07:55:25.110Z DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.RestTemplate : Accept=[text/plain, application/json, application/*+json, */*] api-1 | 2024-06-11T07:55:25.170Z DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.RestTemplate : Response 200 OK api-1 | 2024-06-11T07:55:25.170Z DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.RestTemplate : Reading to [java.lang.String] as "application/json;charset=UTF-8" api-1 | 2024-06-11T07:55:25.175Z DEBUG 1 --- [nio-8080-exec-2] o.s.s.o.s.r.a.JwtAuthenticationProvider : Authenticated token api-1 | 2024-06-11T07:55:25.175Z DEBUG 1 --- [nio-8080-exec-2] .s.r.w.a.BearerTokenAuthenticationFilter : Set SecurityContextHolder to JwtAuthenticationToken [Principal=org.springframework.security.oa uth2.jwt.Jwt@99718017, Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=172.18.0.1, SessionId=null], Granted Authorities=[SCOPE_openid, SCOPE_email, ROLE_admin, SCOPE_profile]] api-1 | 2024-06-11T07:55:25.175Z DEBUG 1 --- [nio-8080-exec-2] o.s.s.a.h.RoleHierarchyImpl : getReachableGrantedAuthorities() - From the roles [SCOPE_openid, SCOPE_email, ROLE_admin, SCOPE_profile] one can reach [ROLE_trainer, SCOPE_openid, SCOPE_email, ROLE_admin, SCOPE_profile] in zero or more steps. api-1 | 2024-06-11T07:55:25.175Z DEBUG 1 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : Secured POST /api/v1/course api-1 | 2024-06-11T07:55:25.176Z DEBUG 1 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : POST "/api/v1/course", parameters={} api-1 | 2024-06-11T07:55:25.176Z DEBUG 1 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to com.summitsync.api.course.CourseController#addCourse(CoursePostDTO, JwtAuthenticationToken) api-1 | 2024-06-11T07:55:25.179Z DEBUG 1 --- [nio-8080-exec-2] m.m.a.RequestResponseBodyMethodProcessor : Read "application/json;charset=UTF-8" to [CoursePostDTO(visible=false, acronym=KL, description=Richtig klettern lernen, dates=[2024-06-10T12:0 (truncated)...] api-1 | 2024-06-11T07:55:25.184Z DEBUG 1 --- [nio-8080-exec-2] org.hibernate.SQL : insert into ss_status (text,status_id) values (?,?) api-1 | 2024-06-11T07:55:25.184Z TRACE 1 --- [nio-8080-exec-2] org.hibernate.orm.jdbc.bind : binding parameter (1:VARCHAR) <- [Zugesagt] api-1 | 2024-06-11T07:55:25.184Z TRACE 1 --- [nio-8080-exec-2] org.hibernate.orm.jdbc.bind : binding parameter (2:BIGINT) <- [3] api-1 | 2024-06-11T07:55:25.187Z DEBUG 1 --- [nio-8080-exec-2] c.s.api.keycloak.KeycloakRestService : adding and retrieving user with name: Pedro api-1 | 2024-06-11T07:55:25.187Z DEBUG 1 --- [nio-8080-exec-2] c.s.api.keycloak.KeycloakRestService : New keycloak request to uri: https://keycloak.summitsync.meschter.me/admin/realms/summit-sync/users (POST) api-1 | 2024-06-11T07:55:25.187Z DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.DefaultRestClient : Writing [KeycloakAddUserRequest(username=Pedro.Rahm, enabled=true, firstName=Pedro, lastName=Rahm, groups=null, email=ped@rora.de, attributes=null, requiredActions=null)] as "application/json" with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter api-1 | 2024-06-11T07:55:25.255Z DEBUG 1 --- [nio-8080-exec-2] .m.m.a.ExceptionHandlerExceptionResolver : Using @ExceptionHandler com.summitsync.api.exceptionhandler.GlobalExceptionHandler#handleKeycloakApiException(KeycloakApiException) api-1 | 2024-06-11T07:55:25.255Z DEBUG 1 --- [nio-8080-exec-2] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json, text/plain, */*] and supported [application/json, application/*+json] api-1 | 2024-06-11T07:55:25.255Z DEBUG 1 --- [nio-8080-exec-2] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [ErrorResponse(error=keycloak, details=User exists with same username)] api-1 | 2024-06-11T07:55:25.256Z DEBUG 1 --- [nio-8080-exec-2] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [com.summitsync.api.exceptionhandler.KeycloakApiException: User exists with same username] api-1 | 2024-06-11T07:55:25.256Z DEBUG 1 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed 409 CONFLICT

onestay commented 5 months ago

Der Participant hat den gleichen Namen, wie der aus #60. Die Kurserstellung scheint fehlgeschlagen zu sein, aber der Participant wurde erstellt. Weiß nicht, ob ich das irgendwie fixen kann, außer das Participants nicht mehr in keycloak gespeichert werden

Flavia-de-Luce commented 5 months ago

Denke auch, ich habe die Namen leicht verändert und dann hat er es geschluckt. Wäre gut wenn die Participants aus Keycloak rausfliegen, die machen nur Ärger... Gerade auf lange Sicht gesehen... Es darf jeder Name nur einmal kommen...