Giter Club home page Giter Club logo

Comments (5)

tommytroen avatar tommytroen commented on May 29, 2024

@puneetbabbar26 This is most likely due to conflicting dependency versions. Can you post your pom.xml or create a sample project with the same dependencies and post the link here?

from mock-oauth2-server.

puneetbabbar26 avatar puneetbabbar26 commented on May 29, 2024

Hey @tommytroen

I tried a Java command line with the entire classpath as well (as derived from pom) to replicate the issue.

here it is

java -classpath ~/.m2/repository/net/minidev/json-smart/2.3/json-smart-2.3.jar:~.m2/repository/com/nimbusds/nimbus-jose-jwt/8.20.2/nimbus-jose-jwt-8.20.2.jar:~.m2/repository/com/fasterxml/jackson/core/jackson-core/2.11.4/jackson-core-2.11.4.jar:~.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.11.4/jackson-databind-2.11.4.jar:~.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.11.4/jackson-annotations-2.11.4.jar:~.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:~.m2/repository/org/jetbrains/kotlin/kotlin-reflect/1.4.32/kotlin-reflect-1.4.32.jar:~.m2/repository/no/nav/security/mock-oauth2-server/0.3.3/mock-oauth2-server-0.3.3.jar:~.m2/repository/com/squareup/okhttp3/mockwebserver/3.14.9/mockwebserver-3.14.9.jar:~.m2/repository/com/squareup/okhttp3/okhttp/3.14.9/okhttp-3.14.9.jar:~.m2/repository/com/nimbusds/oauth2-oidc-sdk/8.36.1/oauth2-oidc-sdk-8.36.1.jar:~.m2/repository/com/nimbusds/lang-tag/1.4.4/lang-tag-1.4.4.jar:~.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.4.32/kotlin-stdlib-1.4.32.jar:~.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:~.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:~.m2/repository/io/netty/netty-all/4.1.63.Final/netty-all-4.1.63.Final.jar:~.m2/repository/io/github/microutils/kotlin-logging-jvm/2.0.6/kotlin-logging-jvm-2.0.6.jar:~.m2/repository/com/fasterxml/jackson/module/jackson-module-kotlin/2.11.4/jackson-module-kotlin-2.11.4.jar:~.m2/repository/org/freemarker/freemarker/2.3.31/freemarker-2.3.31.jar no.nav.security.mock.oauth2.StandaloneMockOAuth2ServerKt

Here's the list of dependencies for easy reading

net/minidev/json-smart/2.3/json-smart-2.3.jar
com/nimbusds/nimbus-jose-jwt/8.20.2/nimbus-jose-jwt-8.20.2.jar
com/fasterxml/jackson/core/jackson-core/2.11.4/jackson-core-2.11.4.jar
com/fasterxml/jackson/core/jackson-databind/2.11.4/jackson-databind-2.11.4.jar
com/fasterxml/jackson/core/jackson-annotations/2.11.4/jackson-annotations-2.11.4.jar
org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar
org/jetbrains/kotlin/kotlin-reflect/1.4.32/kotlin-reflect-1.4.32.jar
no/nav/security/mock-oauth2-server/0.3.3/mock-oauth2-server-0.3.3.jar
com/squareup/okhttp3/mockwebserver/3.14.9/mockwebserver-3.14.9.jar
com/squareup/okhttp3/okhttp/3.14.9/okhttp-3.14.9.jar
com/nimbusds/oauth2-oidc-sdk/8.36.1/oauth2-oidc-sdk-8.36.1.jar
com/nimbusds/lang-tag/1.4.4/lang-tag-1.4.4.jar
org/jetbrains/kotlin/kotlin-stdlib/1.4.32/kotlin-stdlib-1.4.32.jar
ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar
io/netty/netty-all/4.1.63.Final/netty-all-4.1.63.Final.jar
io/github/microutils/kotlin-logging-jvm/2.0.6/kotlin-logging-jvm-2.0.6.jar
com/fasterxml/jackson/module/jackson-module-kotlin/2.11.4/jackson-module-kotlin-2.11.4.jar

from mock-oauth2-server.

tommytroen avatar tommytroen commented on May 29, 2024

@puneetbabbar26 it looks like you have got the wrong versions of the okhttp3 libs - they should be on at least 4.9.1, but in your output they are on 3.14.9:

com/squareup/okhttp3/mockwebserver/3.14.9/mockwebserver-3.14.9.jar
com/squareup/okhttp3/okhttp/3.14.9/okhttp-3.14.9.jar

Are you using Spring Boot in your app? I know some users have had some issues with Spring managed versions on okhttp3. If you are using Spring you can try to set the property okhttp3.version to 4.9.1 in your pom.xml.

from mock-oauth2-server.

puneetbabbar26 avatar puneetbabbar26 commented on May 29, 2024

Thanks @tommytroen I was able to get it to run after spending a lot of time trying to fix the dependencies.
Suggestion - For standalone can you provide a FAT JAR that has all the dependencies that are needed to run the mock-oauth2-server with ease?

Also, I have struggled badly to get the mock server to behave correctly with the expectations and correct tokens. I have used the following file to add 5 different users.

{
    "interactiveLogin": false,
    "httpServer": "NettyWrapper",
    "tokenCallbacks": [
        {
            "issuerId": "default",
            "tokenExpiry": 3600,
            "requestMappings": [
                {
                    "requestParam": "testparam1",
                    "match": "testuser1",
                    "claims": {
                        "userid": "testuser1"
                    }
                }
            ]
        },
        {
            "issuerId": "default",
            "tokenExpiry": 3600,
            "requestMappings": [
                {
                    "requestParam": "testparam2",
                    "match": "testuser2",
                    "claims": {
                        "userid": "testuser2"
                    }
                }
            ]
        },
        {
            "issuerId": "default",
            "tokenExpiry": 3600,
            "requestMappings": [
                {
                    "requestParam": "posuser1",
                    "match": "posuser1",
                    "claims": {
                        "userid": "posuser1"
                    }
                }
            ]
        },
        {
            "issuerId": "default",
            "tokenExpiry": 3600,
            "requestMappings": [
                {
                    "requestParam": "posmanager1",
                    "match": "posmanager1",
                    "claims": {
                        "userid": "posmanager1"
                    }
                }
            ]
        },
        {
            "issuerId": "default",
            "tokenExpiry": 3600,
            "requestMappings": [
                {
                    "requestParam": "testparam3",
                    "match": "testuser3",
                    "claims": {
                        "userid": "testuser3"
                    }
                }
            ]
        }
    ]
}

The server would only retain 1 match (randomly) and send the custom claim in token and would not send the custom claim in the token for others.

This is very frustrating to use, you should spruce up the documentation.

I am giving up now, will see in the next few months if the developer experience has improved

from mock-oauth2-server.

tommytroen avatar tommytroen commented on May 29, 2024

Sorry to hear that you feel its frustrating to use, it can be hard to predict use-cases and how the server is used by different users. We will have a look at the documentation. If you have any specific issues please feel free to open separate issues with details for this. In regards to the FAT jar use case we feel this is covered by the docker version. Closing this issue now.

from mock-oauth2-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.