Git Product home page Git Product logo

Comments (4)

jmelberg-okta avatar jmelberg-okta commented on August 19, 2024

@halestock: To keep with the coding conventions throughout this SDK, we suggest checking the AuthResult status with the getStatus() method. For example:

AuthApiClient authClient = new AuthApiClient(oktaSettings);

// Check if the user credentials are valid
AuthResult result = authClient.authenticate(username, password, someRelayState);

// Verify SUCCESS status
if (result.getStatus().equals("SUCCESS")) { /* Do something */ }

from okta-sdk-java.

halestock avatar halestock commented on August 19, 2024

@jmelberg-okta I'm referring to the fact that you cannot use the fields in AuthResult.Status to compare against when calling result.getStatus(). Ideally, I would just use result.getStatus().equals(AuthResult.Status.SUCCESS) instead of hardcoding "SUCCESS" or defining these constants in my app. However, since they are not static, I would instead have to do:

AuthResult result = authClient.authenticate(username, password, someRelayState);
AuthResult.Status statuses = new AuthResult.Status();
// verify
if (result.getStatus().equals(statuses.SUCCESS)) { /* do something */ }

This seems to be pretty unnecessary. The fix is very straight forward, just defining the strings as static themselves:

public static class Status {
    public static final String PASSWORD_WARN = "PASSWORD_WARN";
    public static final String PASSWORD_EXPIRED = "PASSWORD_EXPIRED";
    public static final String RECOVERY = "RECOVERY";
    public static final String RECOVERY_CHALLENGE = "RECOVERY_CHALLENGE";
    public static final String PASSWORD_RESET = "PASSWORD_RESET";
    public static final String LOCKED_OUT = "LOCKED_OUT";
    public static final String MFA_ENROLL = "MFA_ENROLL";
    public static final String MFA_ENROLL_ACTIVATE = "MFA_ENROLL_ACTIVATE";
    public static final String MFA_REQUIRED = "MFA_REQUIRED";
    public static final String MFA_CHALLENGE = "MFA_CHALLENGE";
    public static final String SUCCESS = "SUCCESS";
}

from okta-sdk-java.

jmelberg-okta avatar jmelberg-okta commented on August 19, 2024

@halestock: Good point. I have created a ticket with our team to update the SDK.

If you are interested in pushing this change yourself, please visit developer.okta.com/cla for more information.

Thanks!

from okta-sdk-java.

jmelberg-okta avatar jmelberg-okta commented on August 19, 2024

Closing as was implemented with PR #58

from okta-sdk-java.

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.