Skip to content
This repository has been archived by the owner on Dec 31, 2021. It is now read-only.

Authentication fails, any ideas? #75

Open
LorCub opened this issue Aug 19, 2021 · 16 comments
Open

Authentication fails, any ideas? #75

LorCub opened this issue Aug 19, 2021 · 16 comments

Comments

@LorCub
Copy link

LorCub commented Aug 19, 2021

Hi there,

After following the guide, every auth attempt raises the following:

org.github.flytreeleft.nexus3.keycloak.plugin.ext.auth0.KeycloakAuthenticatingRealm - doGetAuthenticationInfo for username via org.apache.shiro.authc.UsernamePasswordToken: false

We use Keycloak 12 and plugin version 0.5.0. Could it be that this plugin does not support OTPs from Keycloak?

Thanks for checking and keep up the good work!

@flytreeleft
Copy link
Owner

@LorCub For supporting OTP, you should setup a proxy before the Nexus3, please read more for Single Sign On (SSO).

@gbellns2
Copy link

gbellns2 commented Aug 24, 2021

I may be having the same issue, so going to post here. My configuration contains a Apache httpd reverse proxy attached to an AWS Classic ELB that redirects authentication to a keycloak instance attached to a AWS ALB. These are the only two Public DNS entries if you will, the CLassic ELB and ALB.

When I installed nexus3 version 3.33.1-01, I modified the configuration to use https/SSL rather than http. That all worked well, but just in case, this is what I changed in the userdata.sh on a RedHat 8.2 image.

    # Configure SSL
    NEXUS_DATA_PATH=/data/1/sonatype-work
    NEXUS_ETC_PATH=$NEXUS_DATA_PATH/nexus3/etc
    JKS_FILE=/data/1/certs/keystore.jks # (the cert is generated using AWS ACM and CN=nexus.node.consul) as I have consul running on the nexus instance.
    cp $JKS_FILE $NEXUS_ETC_PATH/ssl/keystore.jks
    chown -R nexus:nexus $NEXUS_ETC_PATH/ssl
    echo "application-port-ssl=8443" >> $NEXUS_ETC_PATH/nexus.properties
    if [ `grep nexus-args $NEXUS_ETC_PATH/nexus.properties | grep "#" | wc -l` -eq 1 ]; then
      echo "nexus-args=\${jetty.etc}/jetty.xml,\${jetty.etc}/jetty-https.xml,\${jetty.etc}/jetty-requestlog.xml" >> $NEXUS_ETC_PATH/nexus.properties
    else
      sed -i "s/jetty-http/jetty-https/g" $NEXUS_ETC_PATH/nexus.properties
    fi
    echo "ssl.etc=\${karaf.data}/etc/ssl" >> $NEXUS_ETC_PATH/nexus.properties
    echo "nexus.security.anticsrftoken.enabled=false" >> $NEXUS_ETC_PATH/nexus.properties
    NEXUS_JETTY_FILE="/${NEXUS_INSTALL_PATH}/nexus-${NEXUS_VERSION}/etc/jetty/jetty-https.xml"
    cp $NEXUS_JETTY_FILE $NEXUS_JETTY_FILE.orig
    KEYSTORE_PASS=$(getProperty $PROP_FILE "javax.net.ssl.keyStorePassword")
    sed -i "s/password/$KEYSTORE_PASS/g" $NEXUS_JETTY_FILE
    echo "Restarting Nexus with SSL"
    service nexus restart

That all works fine and I can log into nexus using the admin account and password and the connection shows secure.

I then found this site, and I did the steps in the README.md. However, I am thinking I must still have something wrong in the $install_dir/keycloak.json. I created the client nexus3 as documented, and followed the other instructions. But when I try to add a user from Keycloak, I get the following error attached as nexusUIerror.txt
nexusUIerror.txt

Here is what I did to configure this plugin.

PLUGIN_VERSION=0.6.0-SNAPSHOT
wget https://github.com/flytreeleft/nexus3-keycloak-plugin/releases/download/0.6.0-prev1-SNAPSHOT/nexus3-keycloak-plugin-0.6.0-SNAPSHOT.jar -O nexus3-keycloak-plugin-0.6.0-SNAPSHOT.jar
JARDIR="org/github/flytreeleft/nexus3-keycloak-plugin/$PLUGIN_VERSION"
NEXUS_INSTALL_PATH=/opt/nexus
NEXUS_VERSION=3.33.0-01
NEXUS_SYS_PATH="${NEXUS_INSTALL_PATH}/nexus-${NEXUS_VERSION}/system"
mkdir -p $NEXUS_SYS_PATH/$JARDIR
cp nexus3-keycloak-plugin-0.6.0-SNAPSHOT.jar $NEXUS_SYS_PATH/$JARDIR/
echo "mvn\\:org.github.flytreeleft/nexus3-keycloak-plugin/$PLUGIN_VERSION = 200" >> ${NEXUS_INSTALL_PATH}/nexus-${NEXUS_VERSION}/etc/karaf/startup.properties

echo '{
  "realm": "xxx",
  "auth-server-url": "https://sso.xxx.com/auth/",
  "ssl-required": "all",
  "resource": "nexus3",
  "verify-token-audience": true,
  "credentials": {
    "secret": "secret"
  },
  "confidential-port": 0,
  "policy-enforcer": {}
}' > ${NEXUS_INSTALL_PATH}/nexus-${NEXUS_VERSION}/etc/keycloak.json

chown -R nexus:nexus $NEXUS_INSTALL_PATH

Here is the errors with the setting auth-server-url setting above set to sso.xxx.com. Sorry, the are not the same.
keycloakauthsettosso.txt

I tried changing the redirect to use the nexus.node.consul as I saw local host in the README, but assuming perhaps keycloak was installed on the same server as nexus for the README.

IMPORTANT: I did not use the eclipse method of creating the cert as mentioned above. I am trying to keep all services I deploy behind the gateway and use consul for DNS so that users only see the services they have permission for. In case it helps, here is the output of the cert.

Your keystore contains 1 entry

Alias name: 1
Creation date: Aug 24, 2021
Entry type: PrivateKeyEntry
Certificate chain length: 3
Certificate[1]:
Owner: CN=nexus.node.consul
Issuer: L=Chantilly, CN=ca1.xxx.com, ST=Virginia, OU=Labs, O=NS2 Labs, C=US
Serial number: a0c9302c735740695bdbc99275372b81
Valid from: Wed Aug 18 12:34:14 UTC 2021 until: Sun Sep 18 13:34:13 UTC 2022
Certificate fingerprints:
         SHA1: 8C:8C:6B:39:13:BC:BE:35:1E:22:0C:8A:BB:68:9F:EA:49:BF:80:BC
         SHA256: 68:90:25:74:38:61:EE:B0:29:D3:BC:37:81:60:92:12:11:6F:DE:85:AD:C3:3A:BF:05:A2:DE:72:44:65:B5:80
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 59 4E FE FA 7B 63 F4 72   AD 36 F6 05 26 A0 93 83  YN...c.r.6..&...
0010: 89 E2 2D D9                                        ..-.
]
]

#2: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
  CA:false
  PathLen: undefined
]

#3: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://xxx.amazonaws.com/crl/xxx.crl]
]]

#4: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  serverAuth
  clientAuth
]

#5: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_Encipherment
]

#6: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
  DNSName: nexus.node.consul
  DNSName: nexus.node.ns2labs.consul
  DNSName: nexus.service.consul
]

#7: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: C7 74 3B CD A1 A7 C1 E8   4A 86 0A 28 25 25 D5 27  .t;.....J..(%%.'
0010: 3E 62 6A 20                                        >bj
]
]

Certificate[2]:
Owner: L=Chantilly, CN=ca1.xxx.com, ST=Virginia, OU=Labs, O=NS2 Labs, C=US
Issuer: L=Chantilly, CN=rootca.xxx.com, ST=Virginia, OU=Labs, O=NS2 Labs, C=US
Serial number: c10e3f4a43ef68f390cad69af44ca6c0
Valid from: Mon Mar 22 20:27:03 UTC 2021 until: Fri Mar 22 21:27:03 UTC 2024
Certificate fingerprints:
         SHA1: B3:5E:D8:DF:97:8F:37:EB:76:39:1C:47:57:26:95:D8:E5:82:17:ED
         SHA256: 43:48:61:7C:02:6B:09:F5:D4:FF:82:8A:B2:0F:FF:14:3C:41:22:A5:C5:6E:D4:6D:23:02:79:FF:EA:62:D2:80
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: A8 A5 2E 15 7C 1C 15 CC   77 E4 AE 5E 32 89 5F 78  ........w..^2._x
0010: E3 95 F9 E0                                        ....
]
]

#2: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:0
]

#3: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://xxx.amazonaws.com/crl/xxx.crl]
]]

#4: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_CertSign
  Crl_Sign
]

#5: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 59 4E FE FA 7B 63 F4 72   AD 36 F6 05 26 A0 93 83  YN...c.r.6..&...
0010: 89 E2 2D D9                                        ..-.
]
]

Certificate[3]:
Owner: L=Chantilly, CN=rootca.xxx.com, ST=Virginia, OU=Labs, O=NS2 Labs, C=US
Issuer: L=Chantilly, CN=rootca.xxx.com, ST=Virginia, OU=Labs, O=NS2 Labs, C=US
Serial number: 5c8c493841dcff02c1343b406a01dc77
Valid from: Mon Mar 22 20:19:18 UTC 2021 until: Sat Mar 22 21:19:18 UTC 2031
Certificate fingerprints:
         SHA1: 53:EB:E6:87:F7:24:7B:1E:30:15:36:D9:97:DE:F2:4A:90:AD:76:13
         SHA256: FC:A1:50:82:24:CA:F7:B7:DB:8C:D1:6E:0B:F2:5F:C2:29:35:A1:47:60:27:35:95:24:90:C5:05:5A:45:9D:AD
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:2147483647
]

#2: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_CertSign
  Crl_Sign
]

#3: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: A8 A5 2E 15 7C 1C 15 CC   77 E4 AE 5E 32 89 5F 78  ........w..^2._x
0010: E3 95 F9 E0                                        ....
]
]



*******************************************
*******************************************



Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.jks -deststoretype pkcs12".

I did add the alias entry to the jetty-https.xml file but it did not seem to make a difference and probably because there is only one cert in that keystore.

I forgot to include the proxy entry, sorry, but reading some of the other closed issues. Is this perhaps because proxy does not support https?

  <location /nexus/>
    AuthType openid-connect
    Require valid-user
  </location>

  ProxyPass             /nexus/    https://nexus.service.consul:8443/
  ProxyPassReverse      /nexus/    https://nexus.service.consul:8443/
  ProxyPass             /service/    https://nexus.service.consul:8443/service/
  ProxyPassReverse      /service/    https://nexus.service.consul:8443/service/
  ProxyPass             /static/    https://nexus.service.consul:8443/static/
  ProxyPassReverse      /static/    https://nexus.service.consul:8443/static/
  ProxyPass             /static/rapture/    https://nexus.service.consul:8443/static/rapture/
  ProxyPassReverse      /static/rapture/    https://nexus.service.consul:8443/static/rapture/
  ProxyPass             /swagger-ui/    https://nexus.service.consul:8443/swagger-ui/
  ProxyPassReverse      /swagger-ui/    https://nexus.service.consul:8443/swagger-ui/

@LorCub
Copy link
Author

LorCub commented Aug 26, 2021

@flytreeleft thanks for your previous answer, I have now the vhost configured and running in openresty (all openidc dependencies installed). But facing an interesting behavior:

  • The nexus URL redirects to the keycloak login, after a successful login, then back to nexus but not yet authenticated, if one waits around 10 seconds then I see the user authenticated. Reloading the page goes back to a non-authenticated session although there is a valid keycloak session, then waiting a few secs one can see the user authenticated.

  • For some reason, the nexus polling from the client to the server intermittently fails

Screenshot 2021-08-26 at 13 51 59

This is leading to Nexus not being usable at all
Screenshot 2021-08-26 at 13 52 10

Is this the plugin's expected behavior?

@flytreeleft
Copy link
Owner

@gbellns2 There should be no problem for proxy with https.

The error org.github.flytreeleft.nexus3.keycloak.plugin.internal.http.HttpResponseException: Unexpected response for url https://nexus.service.consul:8443/auth/realms/NS2labs/protocol/openid-connect/token: 405 / HTTP method POST is not supported by this URL in the nexusUIerror.txt means that you specify a wrong Keycloak server address, the https://nexus.service.consul:8443 is the address of Nexus, not the Keycloak's.

The NPE error in the keycloakauthsettosso.txt should be the same problem.

You should make sure that auth-server-url in the $install_dir/keycloak.json was the URL of the Keycloak server, and it should be the local domain or address which can be accessed by the Nexus.

@flytreeleft
Copy link
Owner

@LorCub Please provide the log messages of Nexus and Keycloak, maybe there are some errors in the server-end.

@flytreeleft
Copy link
Owner

@LorCub @gbellns2 Please try to use nexus3-keycloak-plugin.zip which can log more details.

@LorCub
Copy link
Author

LorCub commented Aug 27, 2021

Please find the logs after a clean start, both Nexus and Keycloak.
15:14 login (no more user interaction after pressing "Sign in")
15:15:39 disconnect from server
15:16 successful login

clean start and login logs.zip

@flytreeleft thanks again for your proactivity

@gbellns2
Copy link

gbellns2 commented Aug 27, 2021

@flytreeleft I I downloded the zip file, install the jar in the appropriate system/dir. I installed the kar in the $install_dir/deploy dir.

I went back to Keycloak and created a new nexus client and the new keycloak.json is:

{
  "realm": "realm",
  "auth-server-url": "https://sso.xxx.com/auth/",
  "ssl-required": "all",
  "resource": "nexus",
  "verify-token-audience": true,
  "credentials": {
    "secret": "123xxx"
  },
  "use-resource-role-mappings": true,
  "confidential-port": 0,
  "policy-enforcer": {}
}

NOTE: I ran across the below in another closed post. Do I need to add this for my proxy:

{
    ...,
    "proxy-url": "http://<proxy-username>:<proxy-password>@<proxy-host>:<proxy-port>",
    ...
}

Or would it be more like proxy-url="https://gateway.domain/nexus/"

I am still getting a null pointer exception when I try to add an external role (admin in keycloak) for nexus client. Error is:

r - Token org.keycloak.representations.AccessTokenResponse@16c087fb will be expired after 28800s
2021-08-27 19:49:28,040+0000 INFO  [qtp1379260238-79]  admin org.github.flytreeleft.nexus3.keycloak.plugin.KeycloakAuthenticatingRealm - https://sso.xxx.com/auth/admin/realms/xxx/clients?clientId=nexus&grant_type=access_token - 200
2021-08-27 19:49:28,077+0000 ERROR [qtp1379260238-79]  admin org.sonatype.nexus.extdirect.internal.ExtDirectExceptionHandler - Failed to invoke action method: coreui_Role.readFromSource, java-method: org.sonatype.nexus.coreui.RoleComponent.readFromSource
java.lang.NullPointerException: null

Here is what I am seeing in the apache httpd logs.

[Fri Aug 27 20:03:13.036388 2021] [auth_openidc:debug] [pid 215797:tid 140519938135808] src/util.c(2462): [client 20.0.0.124:46428] oidc_util_hdr_table_set: Cookie: NX-ANTI-CSRF-TOKEN=0.004160155460654957; _ga=GA1.2.1090768058.1630093749; _gid=GA1.2.574410069.1630093749; _ga=GA1.3.1090768058.1630093749; _gid=GA1.3.574410069.1630093749; _rdt_uuid=1630093749725.1dcd6c10-3699-4c7b-ab68-3aedbc0a9fc4; _fbp=fb.1.1630093750125.1272542180; NXSESSIONID=f4fe2b6a-d919-40e0-84e6-747f86ad3178, referer: https://gateway.ns2labstest.com/nexus/
[Fri Aug 27 20:03:13.036399 2021] [authz_core:debug] [pid 215797:tid 140519938135808] mod_authz_core.c(820): [client 20.0.0.124:46428] AH01626: authorization result of Require valid-user : granted, referer: https://gateway.ns2labstest.com/nexus/
[Fri Aug 27 20:03:13.036405 2021] [authz_core:debug] [pid 215797:tid 140519938135808] mod_authz_core.c(820): [client 20.0.0.124:46428] AH01626: authorization result of <RequireAny>: granted, referer: https://gateway.ns2labstest.com/nexus/
[Fri Aug 27 20:03:13.036563 2021] [proxy:debug] [pid 215797:tid 140519938135808] mod_proxy.c(1254): [client 20.0.0.124:46428] AH01143: Running scheme https handler (attempt 0), referer: https://gateway.ns2labstest.com/nexus/
[Fri Aug 27 20:03:13.036577 2021] [proxy_ajp:debug] [pid 215797:tid 140519938135808] mod_proxy_ajp.c(743): [client 20.0.0.124:46428] AH00894: declining URL https://nexus.service.consul:8443/service/extdirect/poll/rapture_State_get, referer: https://gateway.ns2labstest.com/nexus/
[Fri Aug 27 20:03:13.036584 2021] [proxy_fcgi:debug] [pid 215797:tid 140519938135808] mod_proxy_fcgi.c(1021): [client 20.0.0.124:46428] AH01076: url: https://nexus.service.consul:8443/service/extdirect/poll/rapture_State_get proxyname: (null) proxyport: 0, referer: https://gateway.ns2labstest.com/nexus/
[Fri Aug 27 20:03:13.036590 2021] [proxy_fcgi:debug] [pid 215797:tid 140519938135808] mod_proxy_fcgi.c(1024): [client 20.0.0.124:46428] AH01077: declining URL https://nexus.service.consul:8443/service/extdirect/poll/rapture_State_get, referer: https://gateway.ns2labstest.com/nexus/
[Fri Aug 27 20:03:13.036598 2021] [proxy:debug] [pid 215797:tid 140519938135808] proxy_util.c(2315): AH00942: HTTPS: has acquired connection for (nexus.service.consul)
[Fri Aug 27 20:03:13.036604 2021] [proxy:debug] [pid 215797:tid 140519938135808] proxy_util.c(2368): [client 20.0.0.124:46428] AH00944: connecting https://nexus.service.consul:8443/service/extdirect/poll/rapture_State_get to nexus.service.consul:8443, referer: https://gateway.ns2labstest.com/nexus/
[Fri Aug 27 20:03:13.036614 2021] [proxy:debug] [pid 215797:tid 140519938135808] proxy_util.c(2577): [client 20.0.0.124:46428] AH00947: connected /service/extdirect/poll/rapture_State_get to nexus.service.consul:8443, referer: https://gateway.ns2labstest.com/nexus/
[Fri Aug 27 20:03:13.042507 2021] [proxy:debug] [pid 215797:tid 140519938135808] proxy_util.c(2330): AH00943: https: has released connection for (nexus.service.consul)

Not sure what redirect the nexus client in keycloak should be configured to, here is what I have today.

image

@flytreeleft
Copy link
Owner

@gbellns2 Please paste the stack trace which is following the error java.lang.NullPointerException: null.

The Valid Redirect URIs is the only one should be filled, and the URI should be your Nexus's public access address with the suffix /*.

@flytreeleft
Copy link
Owner

@LorCub Your configuration should be right, and the user authenticating is OK too.

I found the error 2021-08-27 15:17:08,485+0200 WARN [qtp2030944656-50] *UNKNOWN org.apache.http.client.protocol.ResponseProcessCookies - Invalid cookie header: "Set-Cookie: AWSALBCORS=xxxxx; Expires=Fri, 03 Sep 2021 13:17:08 GMT; Path=/; SameSite=None; Secure". Invalid 'expires' attribute: Fri, 03 Sep 2021 13:17:08 GMT. It should be the cause for your problem. I can not specify why the expires isn't valid, maybe your proxy passed the invalid cookie, so you should try to figure out it.

@gbellns2
Copy link

gbellns2 commented Aug 29, 2021

@flytreeleft

I modified the nexus client to the following.
image

I also tried nexus.service.consul:8443/nexus/*

Attached are the keycloak and nexus logs with redirect url set to server:8443/nexus/*.
keycloakerror.txt
nexus.log

In the nexus log, I restarted nexus and tried to sign in with my user name that you will see in the logs.

Then I logged in as admin, and tried to map an external role to keycloak.

I still must have something off in the config as I see.

Started Sonatype Nexus OSS 3.33.0-01

-------------------------------------------------
2021-08-29 11:13:44,990+0000 INFO  [qtp1379260238-75]  *UNKNOWN org.apache.shiro.session.mgt.AbstractValidatingSessionManager - Enabling session validation scheduler...
2021-08-29 11:13:45,020+0000 INFO  [qtp1379260238-75]  *UNKNOWN org.sonatype.nexus.internal.security.anonymous.AnonymousManagerImpl - Loaded configuration: OrientAnonymousConfiguration{enabled=false, userId='anonymous', realmName='NexusAuthorizingRealm'}
2021-08-29 11:13:47,571+0000 INFO  [qtp1379260238-78]  *UNKNOWN org.github.flytreeleft.nexus3.keycloak.plugin.ext.auth0.KeycloakUserManager - org.github.flytreeleft.nexus3.keycloak.plugin.ext.auth0.KeycloakUserManager is starting...
2021-08-29 11:13:47,572+0000 INFO  [qtp1379260238-78]  *UNKNOWN org.github.flytreeleft.nexus3.keycloak.plugin.ext.auth2.KeycloakUserManager - org.github.flytreeleft.nexus3.keycloak.plugin.ext.auth2.KeycloakUserManager is starting...
2021-08-29 11:13:47,572+0000 INFO  [qtp1379260238-78]  *UNKNOWN org.github.flytreeleft.nexus3.keycloak.plugin.internal.KeycloakUserManager - org.github.flytreeleft.nexus3.keycloak.plugin.internal.KeycloakUserManager is starting...
2021-08-29 11:13:47,573+0000 INFO  [qtp1379260238-78]  *UNKNOWN org.github.flytreeleft.nexus3.keycloak.plugin.ext.auth1.KeycloakUserManager - org.github.flytreeleft.nexus3.keycloak.plugin.ext.auth1.KeycloakUserManager is starting...

When I logged in the first time as admin, I did select disable anonymous.

Also, for what it is worth, my Keycloak Realm is mixed case: NS2labs.
I do know that I am hitting keycloak as it locks my account after 3 failed attempts.

@flytreeleft
Copy link
Owner

@gbellns2 What's version of the Keycloak? Maybe there is a compatibility problem, because I found the following error message in the Keycloak logs:

10:46:56,822 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-354) Uncaught server error: java.lang.RuntimeException: com.fasterxml.jackson.databind.JsonMappingException: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) (through reference chain: org.keycloak.representations.AccessToken["[anySetter]"]->java.util.HashMap["null"])

@gbellns2
Copy link

@flytreeleft Keycloak 13.0.0 is the version I have. I noticed that but thought it was a value I was not setting on the nexus config side.

@gbellns2
Copy link

@gbellns2 What's version of the Keycloak? Maybe there is a compatibility problem, because I found the following error message in the Keycloak logs:

10:46:56,822 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-354) Uncaught server error: java.lang.RuntimeException: com.fasterxml.jackson.databind.JsonMappingException: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) (through reference chain: org.keycloak.representations.AccessToken["[anySetter]"]->java.util.HashMap["null"])

I think this error was do to the fact that the mapper I added to the nexus client "groups", I did not set the Token Claim Name to groups.

@gbellns2
Copy link

gbellns2 commented Aug 30, 2021

@flytreeleft I upgraded keycloak to 15.0.2. I am still seeing the same behavior. Guess I should ask, what Keycloak version have you tested this with?
--Sorry checked docs again and it said 3.X to ~14.X
Also, I am assuming that I should be able to log in as nexus admin, configure Realm for keycloak, then when I try to map a role to keycloak I should be able to see the admin role in the pull down.

@flytreeleft
Copy link
Owner

@gbellns2 Sorry for reply late, I'm busy on other work, maybe after few days, I will check it more details.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants