auth0 / auth0-java

Java client library for the Auth0 platform
https://auth0.com
MIT License
286 stars 131 forks source link

Exposing a method in AuthAPI to delete MFA authenticators. #539

Closed vasantteja closed 1 year ago

vasantteja commented 1 year ago

Checklist

Describe the problem you'd like to have solved

We have the methods in AuthAPI to add and list oob and otp authenticators. It will be nice to have a method to delete those authenticators.

Describe the ideal solution

public Request<Void> deleteAuthenticator(String accessToken, String authenticatorId) {
    Asserts.assertNotNull(accessToken, "access token");
    Asserts.assertNotNull(authenticatorId, "authenticatorId");

    String url = baseUrl
        .newBuilder()
        .addPathSegment("mfa")
        .addPathSegment("authenticators")
        .build()
        .toString();

    VoidRequest request = new VoidRequest(client, null, url, HttpMethod.DELETE);
    request.addHeader("Authorization", "Bearer " + accessToken);
    request.addParameter(AUTHENTICATOR_ID, authenticatorId);
    return request;
}

Alternatives and current workarounds

No response

Additional context

No response

jimmyjames commented 1 year ago

👋 hey @vasantteja, thanks for the issue and the implementation snippet 😄. If you'd like to make a PR for this feature, I'm happy to review and help along the way (looks like you've pretty much got the implementation already 😉)! If not, we should be able to get a PR for this out this week. Thanks!

vasantteja commented 1 year ago

@jimmyjames Sure let me take a stab at it. Thanks for the opportunity!!

jimmyjames commented 1 year ago

Fixed with #541 - Thanks @vasantteja! I'll cut a new release either tomorrow or early next week; will see if there are other changes we want to include in a new minor 👍