简体   繁体   中英

IBM MobileFirst SDK How to check if user authentication Android Native app

I am developing Android native application integrated with IBM MobileFirst backend.

I have issue with some operations that required custom authentication with predefined realm for example (" testAuthRealm ")

and when I call any operation that requires authentication and user is not authentication it is returning a response with some details:

WL version: 7.1

Anyway, I can detect from the response that the user is not authenticated but I think this is not a good way to check authentication.

my inquiry:

  • is there any supported method from the MF SDK to check user authorization for realm?
  • is that good to check authorization from the response?

advise please

If you request a protected resource, the server response will contain the authorization status required ( based on your custom authenticator implementation). This server response would kick off the challenge handling procedure in your client application. This is by design. Refer to Custom Authentication documentation . This way you need not separately check for the authorization status yourselves and then try to login.

  1. Is there any supported method from the MF SDK to check user authorization for realm?

    You can consider one of the following APIs in the client SDK:

    a) isAuthorizationRequired

    b) getUserIdentity

    c) getLoginName

    d) getUserName

  2. Is that good to check authorization from the response?

    Challenge handling at the client will depend on the status of authorization(from the server response). Based on this status, you either handle the challenge or allow access. So, you need to check and verify the server response to complete the authentication flow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM