Skip to content

Spring Boot + spring-security-oauth2-resource-server should not throw a ClassNotFoundException once it supports more than one token formatΒ #6209

Closed

Description

@jzheaux

While it's true that Resource Server effectively requires spring-security-oauth2-jose at this point, it shouldn't once it supports more than one token format.

When spring-boot-starter-security and spring-security-oauth2-resource-server are used together, without further configuration, the application throws the following exception:

Caused by: java.lang.ClassNotFoundException: org.springframework.security.oauth2.jwt.JwtDecoder
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 111 more

In all likelihood, this will be taken care of naturally when coordinating with the boot team to add support for a second token format.

Activity

  1. added
    in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)
    on Nov 30, 2018
  2. added this to the 5.2.0.M1 milestone on Nov 30, 2018
  3. self-assigned this
    on Nov 30, 2018
  4. rwinch commented on Dec 1, 2018

    @rwinch
    Member

    @jzheaux There is a spring-boot-starter-oauth2-resource-server that should resolve this. There is a ticket for adding it to start.spring.io

  5. changed the title [-]Spring Boot + spring-security-oauth2-resource-server throws ClassNotFoundException on startup[/-] [+]Spring Boot + spring-security-oauth2-resource-server should not throw a ClassNotFoundException once it supports more than one token format[/+] on Dec 1, 2018
  6. jzheaux commented on Dec 1, 2018

    @jzheaux
    CollaboratorAuthor

    Thanks for the tip, @rwinch, about the starter. Agreed that including the starter is simpler, especially since spring-security-oauth2-jose is effectively required right now, even though resource server lists it as an optional dependency.

    Are you thinking that its okay to throw a ClassNotFoundException when a user uses spring-boot-starter-security and spring-security-oauth2-resource-server (instead of the starter you mentioned)? I think it's okay for now since resource server only supports JWT. But once resource server supports more than one token format, I think this exception would confuse users.

    I re-titled the issue for clarity, but I think it's kind of gangly. Suggestions welcome.

  7. rwinch commented on Dec 3, 2018

    @rwinch
    Member

    It seems like that would be the case. Won't that naturally sort itself out or is this just to ensure we validate that?

  8. jzheaux commented on Dec 5, 2018

    @jzheaux
    CollaboratorAuthor

    This is just to ensure we validate that. Agreed that it should naturally sort itself out.

  9. edeandrea commented on Dec 11, 2018

    @edeandrea
    Contributor

    The Spring Boot team is doing a check on their side as well (see spring-projects/spring-boot#15372).

  10. modified the milestones: 5.2.0.M1, 5.2.0.M2 on Jan 16, 2019
  11. modified the milestones: 5.2.0.M2, 5.2.0.RC1 on Apr 15, 2019
  12. modified the milestones: 5.2.0.M4, 5.2.0.RC1 on Aug 5, 2019
  13. jzheaux commented on Sep 4, 2019

    @jzheaux
    CollaboratorAuthor

    Confirmed by creating a project using the describing configuration and observing that it ran without error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: enhancementA general enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions