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

fix: unable to insert oidc client #2455

Closed
moabu opened this issue Sep 23, 2022 · 9 comments
Closed

fix: unable to insert oidc client #2455

moabu opened this issue Sep 23, 2022 · 9 comments
Assignees
Labels
kind-bug Issue or PR is a bug in existing functionality
Milestone

Comments

@moabu
Copy link
Member

moabu commented Sep 23, 2022

OidcClient

error:

Caused by: 
com.querydsl.core.QueryException: Caught SQLException for insert into jansdb.jansClnt (jansAccessTknAsJwt, jansAccessTknSigAlg, jansAppTyp, jansAttrs, inum, displayName, jansClntSecret, jansClntURI, del, jansDisabled, jansLogoutSessRequired, jansLogoutURI, jansGrantTyp, jansInclClaimsInIdTkn, jansLogoURI, jansPersistClntAuthzs, jansPolicyURI, jansRedirectURI, jansRptAsJwt, jansScope, jansSubjectTyp, jansTknEndpointAuthMethod, jansTosURI, jansTrustedClnt, objectClass, dn, doc_id)|values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
...
Caused by: 
java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05sr...' for column 'displayName' at row 1

The payload is the following:

{
  "dn": "inum=1201.d52300ed-8193-510e-b31d-5829f4af346e,ou=clients,o=jans",
  "inum": "1201.d52300ed-8193-510e-b31d-5829f4af346e",
  "displayName": "test-client",
  "clientSecret": "SEw7VOX8m9ah",
  "frontChannelLogoutUri": "null",
  "redirectUris": [
    "https://moabu-21f13b7c-9069-ad58-5685-852e6d236020.gluu.info/.well-known/scim-configuration"
  ],
  "grantTypes": [
    "client_credentials"
  ],
  "applicationType": "native",
  "subjectType": "pairwise",
  "tokenEndpointAuthMethod": "client_secret_basic",
  "scopes": [
    "inum=9e4d1b6a-a978-4457-bc16-cda74309ee04,ou=scopes,o=jans"
  ],
  "accessTokenSigningAlg": "RS256",
  "attributes": {
    "parLifetime": 600
  },
  "authenticationMethod": "client_secret_basic",
  "baseDn": "inum=1201.d52300ed-8193-510e-b31d-5829f4af346e,ou=clients,o=jans"
}
@moabu moabu self-assigned this Sep 23, 2022
@moabu moabu changed the title fix: unable to inset oidc client fix: unable to insert oidc client Sep 23, 2022
@mo-auto mo-auto added the kind-bug Issue or PR is a bug in existing functionality label Sep 23, 2022
@moabu
Copy link
Member Author

moabu commented Sep 23, 2022

Related #2288

@moabu moabu assigned pujavs and unassigned moabu Sep 28, 2022
@pujavs
Copy link
Contributor

pujavs commented Sep 28, 2022

Working fine in LDAP but throwing the above error in MySQL. Attached logs and testing details.
Analysis: Issue with column "jansClntURI": { "mysql": { "type": "TINYTEXT" }
Seems common issue with MySQL -> incorrect-string-value
Added extra logs for debug and captured logs, assigning to @yurem for guidance
LDAP Testing with latest code:
image

MySQL Testing with latest code:
image

Logs:
logs_mysql_logs_2455.zip

@moabu moabu added this to the 1.0.3 milestone Sep 29, 2022
@pujavs
Copy link
Contributor

pujavs commented Sep 30, 2022

assigning to @yurem for verification

@yurem
Copy link
Contributor

yurem commented Oct 3, 2022

@pujavs can you share sample displayName which led to this issue?

@pujavs
Copy link
Contributor

pujavs commented Oct 4, 2022

sample data
curl -X POST -k -H 'Content-Type: application/json' -H 'Authorization: Bearer f701d576-28cb-46d0-a8a0-61dab4ce0dac' -i 'https://jenkins-build.jans.io/jans-config-api/api/v1/openid/clients/' --data '{"dn": "inum=1201.d52300ed-8193-510e-b31d-5829f4af346e,ou=clients,o=jans","inum": "1201.d52300ed-8193-510e-b31d-5829f4af346e","displayName": "test-client","clientSecret": "SEw7VOX8m9ah","frontChannelLogoutUri": "null","redirectUris": ["https://moabu-21f13b7c-9069-ad58-5685-852e6d236020.gluu.info/.well-known/scim-configuration"],"grantTypes": ["client_credentials"],"applicationType": "native","subjectType": "pairwise","tokenEndpointAuthMethod": "client_secret_basic","scopes": ["inum=03F8-EDD7,ou=scopes,o=jans"],"accessTokenSigningAlg": "RS256","attributes": {"parLifetime": 600},"authenticationMethod": "client_secret_basic","baseDn": "inum=1201.d52300ed-8193-510e-b31d-5829f4af346e,ou=clients,o=jans"}'

@yurem
Copy link
Contributor

yurem commented Oct 5, 2022

This issue related to #1482

@yurem
Copy link
Contributor

yurem commented Oct 5, 2022

displayName in DB defined as text type. But in code it's LocalizedString. ORM is trying to convert object to String and send value to server. And we see in logs results of this HashMap->String conversion:

Incorrect string value: '\xAC\xED\x00\x05sr...' for column 'displayName' at row 1

изображение

@yurem
Copy link
Contributor

yurem commented Oct 5, 2022

I added quick fix to instruct ORM to work with LocalizedString as with multivalued attribute: https://github.com/JanssenProject/jans/pull/2542/files

@yurem
Copy link
Contributor

yurem commented Oct 5, 2022

We need to fix: #1482 to avoid such issues in future

@yurem yurem closed this as completed Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind-bug Issue or PR is a bug in existing functionality
Projects
None yet
Development

No branches or pull requests

4 participants