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

IdP Discovery Policy not returned in listPolicyRules() #983

Closed
Marek26 opened this issue Feb 16, 2024 · 2 comments
Closed

IdP Discovery Policy not returned in listPolicyRules() #983

Marek26 opened this issue Feb 16, 2024 · 2 comments

Comments

@Marek26
Copy link

Marek26 commented Feb 16, 2024

Describe the bug?

We need to use the Policy API to retrieve the IdP Discovery Policy and the corresponding rules.
We need the corresponding conditions & actions as described in the API documentation.
Explicitly we need the user identifier patterns & to which IDPs the routing is done.
This is currently not possible with the SDK.
If you call the API manually, you get the correct result:

GET xxx/api/v1/policies/xxx/rules
 
{
[
    {
        "id": "xxx",
        "status": "ACTIVE",
        "name": "Default Rule",
        "priority": 1,
        "created": null,
        "lastUpdated": "2023-03-06T07:41:08.000Z",
        "system": true,
        "conditions": {
            "network": {
                "connection": "ANYWHERE"
            },
            "platform": {
                "include": [],
                "exclude": []
            },
            "userIdentifier": {
                "patterns": []
            },
            "app": {
                "include": [],
                "exclude": []
            }
        },
        "actions": {
            "idp": {
                "providers": [
                    {
                        "type": "OKTA"
                    }
                ],
                "idpSelectionType": "SPECIFIC"
            }
        },
        "_links": {
            "self": {
                "href": "xxx",
                "hints": {
                    "allow": [
                        "GET",
                        "PUT"
                    ]
                }
            }
        },
        "type": "IDP_DISCOVERY"
    }
]
}

What is expected to happen?

api.listPolicyRules(String policyId) should return an implementation of PolicyRule that can be mapped to the actual result by the API (IdP Discovery Policy).

What is the actual behavior?

Currently there is no implementation which matches the rules of the IdP Discovery Policy.

image

If you don't cast api.listPolicyRules(String policyId) returns the implementation AccessPolicyRule which is the policy rule for the Authentication API.

Reproduction Steps?

final var idpPolicy = policyApi.listPolicies(IDP_DISCOVERY.getValue(), null, null).stream()
    .toList()
    .getFirst();
return policyApi.listPolicyRules(idpPolicy.getId()).stream()
    .map(AccessPolicyRule.class::cast)
    .toList();

Additional Information?

No response

Java Version

temurin-21.0.2

SDK Version

com.okta.sdk okta-sdk-api 15.0.0

com.okta.sdk okta-sdk-impl 15.0.0

OS version

No response

@arvindkrishnakumar-okta
Copy link
Contributor

Thanks for posting!

I'll work on this and update you. Please stay tuned.

@arvindkrishnakumar-okta arvindkrishnakumar-okta changed the title IdP DIscovery Policy not returned via SDK IdP DIscovery Policy not returned Feb 22, 2024
@arvindkrishnakumar-okta arvindkrishnakumar-okta changed the title IdP DIscovery Policy not returned IdP Discovery Policy not returned Mar 29, 2024
@arvindkrishnakumar-okta arvindkrishnakumar-okta changed the title IdP Discovery Policy not returned IdP Discovery Policy not returned in listPolicyRules() Mar 29, 2024
@arvindkrishnakumar-okta
Copy link
Contributor

#983 should fix this.

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

No branches or pull requests

2 participants