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

Crash lors de la connexion avec un utilisateur créé via l'api #3

Open
MartinDelille opened this issue Jan 15, 2019 · 5 comments
Open
Assignees

Comments

@MartinDelille
Copy link
Member

Quand je créé l'utilisateur MartinDelille avec les mêmes paramètres ( id, email, password et name) puis que j'essaye de me connecter via l'intranet, ça fait planter XWiki:

Etat HTTP 500 - Failed to handle Resource Reference [path = authorization, endpoint = authorization, pathSegments = []]
type Rapport d''exception

message Failed to handle Resource Reference [path = authorization, endpoint = authorization, pathSegments = []]

description Le serveur a rencontré une erreur interne qui l''a empêché de satisfaire la requête.

exception

javax.servlet.ServletException: Failed to handle Resource Reference [path = authorization, endpoint = authorization, pathSegments = []]
	org.xwiki.resource.servlet.ResourceReferenceHandlerServlet.handleResourceReference(ResourceReferenceHandlerServlet.java:161)
	org.xwiki.resource.servlet.ResourceReferenceHandlerServlet.service(ResourceReferenceHandlerServlet.java:87)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
	org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:147)
cause mère

org.xwiki.resource.ResourceReferenceHandlerException: Failed to handle http servlet request
	org.xwiki.contrib.oidc.provider.internal.OIDCResourceReferenceHandler.handle(OIDCResourceReferenceHandler.java:110)
	org.xwiki.resource.internal.DefaultResourceReferenceHandlerChain.handleNext(DefaultResourceReferenceHandlerChain.java:79)
	org.xwiki.resource.internal.AbstractResourceReferenceHandlerManager.handle(AbstractResourceReferenceHandlerManager.java:82)
	org.xwiki.resource.servlet.ResourceReferenceHandlerServlet.handleResourceReference(ResourceReferenceHandlerServlet.java:159)
	org.xwiki.resource.servlet.ResourceReferenceHandlerServlet.service(ResourceReferenceHandlerServlet.java:87)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
	org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:147)
cause mère

java.lang.ClassCastException: org.xwiki.contrib.oidc.provider.internal.store.OIDCConsent cannot be cast to org.xwiki.contrib.oidc.provider.internal.store.OIDCConsent
	org.xwiki.contrib.oidc.provider.internal.store.OIDCStore.getConsent(OIDCStore.java:181)
	org.xwiki.contrib.oidc.provider.internal.store.OIDCStore.getConsent(OIDCStore.java:154)
	org.xwiki.contrib.oidc.provider.internal.endpoint.AuthorizationOIDCEndpoint.handle(AuthorizationOIDCEndpoint.java:152)
	org.xwiki.contrib.oidc.provider.internal.OIDCResourceReferenceHandler.handle(OIDCResourceReferenceHandler.java:130)
	org.xwiki.contrib.oidc.provider.internal.OIDCResourceReferenceHandler.handle(OIDCResourceReferenceHandler.java:108)
	org.xwiki.resource.internal.DefaultResourceReferenceHandlerChain.handleNext(DefaultResourceReferenceHandlerChain.java:79)
	org.xwiki.resource.internal.AbstractResourceReferenceHandlerManager.handle(AbstractResourceReferenceHandlerManager.java:82)
	org.xwiki.resource.servlet.ResourceReferenceHandlerServlet.handleResourceReference(ResourceReferenceHandlerServlet.java:159)
	org.xwiki.resource.servlet.ResourceReferenceHandlerServlet.service(ResourceReferenceHandlerServlet.java:87)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
	org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:147)

Pour reproduire, il faut d'abord mettre des valeurs valides ici:

https://github.com/atelierdesmedias/usersync/blob/1-implement-discourse-api/usersync-connectors/usersync-connector-discourse/src/main/java/org/xwiki/contrib/usersync/discourse/internal/DiscourseUserSyncConnector.java#L77-L79

Puis utiliser les informations de son user ici:
https://github.com/atelierdesmedias/usersync/blob/1-implement-discourse-api/usersync-connectors/usersync-connector-discourse/src/test/java/org/xwiki/contrib/usersync/discourse/internal/DiscourseUserSyncConnectorTest.java#L62-L65

@tmortagne
Copy link
Member

org.xwiki.contrib.oidc.provider.internal.store.OIDCConsent cannot be cast to org.xwiki.contrib.oidc.provider.internal.store.OIDCConsent

Hmm ça ressemble plus à un problème de classloader après un upgrade en fait. Je restart l'intranet et tu pourra retester.

@MartinDelille
Copy link
Member Author

MartinDelille commented Jan 17, 2019

C'est réglé par contre si je créé un utilisateur (exemple: MartinDelille) via l'api et que j'essaye de me connecter avec l'intranet, il me propose de créer un compte et ça échoue car forcément, il y a un compte existant avec cette adresse email.

J'ai du coup supprimé MartinDelille et créé un compte via l'intranet pour voir si il y avait des métadata en plus et je ne vois rien:

{
  "user_badges": [],
  "user": {
    "id": 19,
    "username": "Martin_Delille",
    "name": "Martin Delille",
    "avatar_template": "/user_avatar/forum.atelier-medias.org/martin_delille/{size}/10_2.png",
    "last_posted_at": null,
    "last_seen_at": null,
    "bio_cooked": null,
    "created_at": "2019-01-16T11:08:39.872Z",
    "can_edit": true,
    "can_edit_username": true,
    "can_edit_email": true,
    "can_edit_name": true,
    "can_send_private_messages": true,
    "can_send_private_message_to_user": true,
    "bio_excerpt": "",
    "trust_level": 0,
    "moderator": false,
    "admin": false,
    "title": null,
    "uploaded_avatar_id": 10,
    "badge_count": 0,
    "has_title_badges": false,
    "custom_fields": {},
    "pending_count": 0,
    "profile_view_count": 0,
    "time_read": 0,
    "recent_time_read": 0,
    "primary_group_name": null,
    "primary_group_flair_url": null,
    "primary_group_flair_bg_color": null,
    "primary_group_flair_color": null,
    "staged": false,
    "second_factor_enabled": false,
    "post_count": 0,
    "can_be_deleted": true,
    "can_delete_all_posts": true,
    "locale": "en",
    "muted_category_ids": [],
    "watched_tags": [],
    "watching_first_post_tags": [],
    "tracked_tags": [],
    "muted_tags": [],
    "tracked_category_ids": [],
    "watched_category_ids": [],
    "watched_first_post_category_ids": [],
    "system_avatar_upload_id": null,
    "system_avatar_template": "https://avatars.discourse.org/v2/letter/m/b4bc9f/{size}.png",
    "gravatar_avatar_upload_id": 10,
    "gravatar_avatar_template": "/user_avatar/forum.atelier-medias.org/martin_delille/{size}/10_2.png",
    "muted_usernames": [],
    "mailing_list_posts_per_day": 0,
    "can_change_bio": true,
    "user_api_keys": null,
    "user_auth_tokens": [],
    "user_auth_token_logs": [],
    "date_of_birth": null,
    "invited_by": null,
    "groups": [
      {
        "id": 10,
        "automatic": true,
        "name": "trust_level_0",
        "display_name": "trust_level_0",
        "user_count": 5,
        "mentionable_level": 0,
        "messageable_level": 0,
        "visibility_level": 0,
        "automatic_membership_email_domains": null,
        "automatic_membership_retroactive": false,
        "primary_group": false,
        "title": null,
        "grant_trust_level": null,
        "incoming_email": null,
        "has_messages": false,
        "flair_url": null,
        "flair_bg_color": null,
        "flair_color": null,
        "bio_raw": null,
        "bio_cooked": null,
        "public_admission": false,
        "public_exit": false,
        "allow_membership_requests": false,
        "full_name": null,
        "default_notification_level": 3,
        "membership_request_template": null
      }
    ],
    "group_users": [
      {
        "group_id": 10,
        "user_id": 19,
        "notification_level": 3
      }
    ],
    "featured_user_badge_ids": [],
    "user_option": {
      "user_id": 19,
      "email_always": false,
      "mailing_list_mode": false,
      "mailing_list_mode_frequency": 1,
      "email_digests": true,
      "email_private_messages": true,
      "email_direct": true,
      "external_links_in_new_tab": false,
      "dynamic_favicon": false,
      "enable_quoting": true,
      "disable_jump_reply": false,
      "digest_after_minutes": 10080,
      "automatically_unpin_topics": true,
      "auto_track_topics_after_msecs": 240000,
      "notification_level_when_replying": 2,
      "new_topic_duration_minutes": 2880,
      "email_previous_replies": 2,
      "email_in_reply_to": true,
      "like_notification_frequency": 1,
      "include_tl0_in_digests": false,
      "theme_ids": [
        3
      ],
      "theme_key_seq": 0,
      "allow_private_messages": true,
      "homepage_id": null,
      "hide_profile_and_presence": false
    }
  }
}

@tmortagne
Copy link
Member

Ce serait plus facile de comparer si tu récupérais aussi les metadata d'un user que tu a créé via l'API.

@MartinDelille
Copy link
Member Author

Bonne remarque! 😅

Je viens de checker et il n'y a aucune différence notable.

@MartinDelille
Copy link
Member Author

Je vais investiguer sur https://meta.discourse.org/

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