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

Hardcoded policy errors #271

Open
geve82 opened this issue Jul 23, 2020 · 1 comment
Open

Hardcoded policy errors #271

geve82 opened this issue Jul 23, 2020 · 1 comment

Comments

@geve82
Copy link
Contributor

geve82 commented Jul 23, 2020

Description:
Policy errors list is hardcoded in org.wso2.carbon.identity.scim2.common.impl.SCIMUserManager.handleErrorsOnUserNameAndPasswordPolicy(Throwable e)

Natively all username and password code are not managed.
Developers can also add their own custom policies and errors code.

If an unknown error code is received a generic CharonException is thrown and a 500 is returned to the caller.
{"schemas":["urn:ietf:params:scim:api:messages:2.0:Error"],"detail":"Error while updating attributes of user: test","status":"500"}
But in those cases it's a user mistake so a 4XX must be returned and an explicit error message must be sent back depending of the policy.

Suggestion:
Create an error code range convention for user errors or a specific class exception to catch.

Suggested Labels:
BUG

Affected Product Version:
All

OS, DB, other environment details and versions:
N/A

Steps to reproduce:
Create your own password policy and try a bad pattern.

Related Issues:
N/A

@ruwanta
Copy link
Contributor

ruwanta commented Sep 11, 2020

There are few error codes and types defined in SCIM specification [1]
What we can do is to have a error translator, to translate the given exception or error to the standard defined by SCIM.

SCIM allows the error detail to be more verbose and human readable.

So we could think of having translation mechanism to {ErrorCode, DcimType, Detail} tuple from internal exception or error

[1] https://tools.ietf.org/html/rfc7644#page-67

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