Employee Identity (EIAM)

Android SDK List

# Overview

The Zhuyun IDaaS Open Platform provides various SDK packages for authentication modules to assist Android mobile developers in quickly integrating functions such as login, registration, and biometric authentication.

# Latest SDK Packages

Module Name SDK Package Latest Version File Size Download Link
Common Development Package AuthnCenter_Common_2E-1.5.3.aar v.1.5.3 0.1M Download Here (opens new window)
Password Login AuthnCenter_PWLogin_2E-1.5.3.aar v.1.5.3 0.1M Download Here (opens new window)
SMS Login AuthnCenter_SMSLogin_2E-1.5.3.aar v.1.5.3 0.1M Download Here (opens new window)
Biometric Authentication AuthnCenter_MFA_BioVerify_2E-1.5.3.aar v.1.5.3 0.1M Download Here (opens new window)
Dynamic Password OTP Authentication AuthnCenter_MFA_OTP-1.5.3.aar v.1.5.3 0.1M Download Here (opens new window)

# Change Log

Version Update Time Update Description
v1.5.3 2022.12.11 Added biometric authentication, SMS, and password login SDKs. The original common package's various business and UI components have been distributed to their respective functional packages. The common package now only includes references to public libraries and utility classes.
v1.4.0 2021.10.11 Fixed known issues, improved SDK stability.

# SDK Package Introduction

# Common Development Package Introduction

Basic configuration initialization main class AuthnCenterAPI method introduction:

/**
 * SMS Verification Code -- Send SMS
 */
public void smsSend(Context context, SendSmsReq req, RequestListener listener)

/**
 * Get Country Code     Note: If country code configuration is required, this interface must be called to obtain the country code.
 */
public void getCountryCode(Context context, RequestListener listener)

/**
 * Social Account Binding Interface
 * @param context      Context
 * @param stateToken   Temporary token returned after current login
 * @param otpsmsReq    Binding object information
 * @param listener     Event callback
 */
public void socialBind(Context context, String stateToken, OTPSMSReq otpsmsReq, RequestListener listener)

/**
 *  Register
 * @param context      Context
 * @param stateToken   Temporary token returned after current login
 * @param otpsmsReq    Registration object information
 * @param listener     Event callback
 */
public void register(Context context, String stateToken, OTPSMSReq otpsmsReq, RequestListener listener)

/**
 * Parse id_token
 * @param context
 * @param id_token  id_token
 * @param listener  Callback event
 */
public void getUserInfoFromIdToken(Context context, String id_token, CallbackListener listener)

/**
 * Verify id_token
 * @param context Context
 * @param id_token  id_token
 * @param listener  Callback event
 */
public void verifySign(Context context, String id_token, VerifySignListener listener)


/**
 * Refresh token
 *
 * @param context   Context
 * @param sessionToken  sessionToken returned after successful login
 * @param listener Callback event
 */
public void refreshToken(Context context, String sessionToken, RequestListener listener)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

/**

  • Get user ID via ID token
  • @param idToken The idtoken returned after successful login */ public String getUserId(String idToken)
The SDK includes a KeyStore operation utility class, which can be called as needed: KeyStoreUtils.


### Password Login Package Introduction
Introduction to the main class AuthnCenterPWDLogin methods for password login initialization:
```java
/**
 * Username and password login
 *
 * @param context Context
 * @param userName Username
 * @param password Password
 * @param loginListener Event callback
 */
public void userLoginRequest(Context context, String userName, String password, PWLoginListener loginListener)

/**
 * Unified user password login
 *   Supports username+password, mobile number+password, and email+password simultaneously
 * @param context Context
 * @param userName Username
 * @param password Password
 * @param loginListener Event callback
 */
public void userLoginAuthRequest(Context context, String userName, String password, PWLoginListener loginListener)

/**
 * Mobile number + password login
 *
 * @param context Context
 * @param mobile Mobile number
 * @param password Password
 * @param loginListener Event callback
 */
public void userLoginMobilePwd(Context context, String mobile, String password, PWLoginListener loginListener)

/**
 * Email + password login
 *
 * @param context Context
 * @param email Email
 * @param password Password
 * @param loginListener Event callback
 */
public void userLoginEmailPwd(Context context, String email, String password, PWLoginListener loginListener)

/**
 * SMS registration
 *
 * @param context Context
 * @param userInfoReq Registration user entity
 * @param loginListener Event callback
 */
public void userRegister(Context context, UserInfoReq userInfoReq, PWLoginListener loginListener)

/**
 * Password recovery
 *
 * @param context Context
 * @param findPwdReq Password recovery entity
 * @param loginListener Event callback
 */
public void findPwd(Context context, FindPwdReq findPwdReq, PWLoginListener loginListener)

/**
 * Skip password change
 *
 * @param context Context
 * @param stateToken stateToken
 * @param loginListener Event callback
 */
public void skipPwd(Context context, String stateToken, PWLoginListener loginListener)

/**
 * Force password change
 *
 * @param context Context
 * @param pwdReq Password change entity
 * @param stateToken stateToken
 * @param loginListener Event callback
 */
public void updatePwd(Context context, UpdatePwdReq pwdReq, String stateToken, PWLoginListener loginListener)
```
PWLoginListener returns different CODE values during login API callbacks. Integrators need to judge and handle related business logic based on different application scenarios.
Currently, only the following codes are returned for passwords about to expire or already expired. Please refer to the integration DEMO for details.
| <span style="display:inline-block;width:80px">Code Value</span> | <span style="display:inline-block;width:160px">Built-in Enum Value</span> | <span style="display:inline-block;width:160px">Explanation</span> |
| :---------------------------------------------------------- | :----------------------------------------------------------- | :--------------------------------------------------------- |
| 10006                                                       | SDKCodeType.*SDK_PASSWORD_EXPIRED*.getCode()                 | Password has expired                                               |
| 10007                                                       | SDKCodeType.*SDK_PASSWORD_WARN*.getCode()                    | Password is about to expire                                               |

### Introduction to SMS Login Package
Introduction to the main class AuthnCenterSMSLogin method for basic configuration initialization:
```JAVA
/**
 * Built-in sliding verification
 *
 * @param mContext Context
 */
BlockPuzzleDialog mBlockPuzzleDialog = new BlockPuzzleDialog(mContext);
mBlockPuzzleDialog.setOnResultsListener(new OnResultsListener() {
        @Override
        public void onResultsClick(String result) {
            LogUtil.getInstance().d("Secondary verification callback result mCaptchaToken:" + result);
            // This callback result is the captchaToken parameter for SMS verification
        }
        @Override
        public void onError(String code, String msg) {
            ToastUtils.ShowToast(mContext, String.format("Error code: %s  Error message: %s", code, msg));
        }
    });
```

### Introduction to Biometric Authentication Package
Introduction to the built-in APIs of the AuthnCenterMFA package:
~~~java

    /**
     * Get binding status
     * @param context Context
     * @param idToken idtoken
     * @param listener Callback event
     *
     */
    public void getStatus(Context context, String idToken, MFAListener listener);

    /**
     *  Bind device
     * @param context Context
     * @param idToken idtoken
     * @param map Parameters
     * @param listener Callback event
     */
    public void bind(Context context, String idToken, Map map, MFAListener listener);
    /**
     * Unbind device
     * @param context Context
     * @param idToken idtoken
     * @param listener Callback event
     */
    public void unbind(Context context, String idToken, MFAListener listener);

    /**
     *   Query authentication status
     * @param context Context
     * @param idToken idtoken
     * @param listener Callback event
     */
    public void getAuthentication(Context context, String idToken, MFAListener listener) ;

    /**
     *   Query authentication status and perform authentication
     * @param context Context
     * @param idToken idtoken
     * @param ob Callback event
     */
    public void getAuthentication(Context context, String idToken, OnBiometricIdentifyCallback ob);

    /**
     *  Initiate authentication
     * @param context Context
     * @param idToken idtoken
     * @param map Parameter map
     * @param listener Callback event
     */
    public void startAuthentication(Context context, String idToken, Map map, MFAListener listener);

    /**
     *  Initiate authentication including biometric recognition
     * @param context Context
     * @param idToken idtoken
     * @param ob Callback event
     */
    public void startBiometric(Context context, String idToken, OnBiometricIdentifyCallback ob);

    /**
     * Bind/Unbind/Query Biometric Authentication
     * @param context Context
     * @param idToken  idtoken
     * @param bt  Enumeration type
     * @param ob  Callback event
     */
    public void startBiometric(Context context, String idToken, BiometricType bt, OnBiometricIdentifyCallback ob);

    /**
     * Get User ID
     * @param idToken  Idtoken
     * @return
     */
    public String getUserId(String idToken);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189

# Introduction to the Dynamic Password OTP Authentication Package

AuthnCenterOTP Method Introduction:

  /**
     * Add TOKEN
     *
     * @param context Context
     * @param text    Character string after QR code scanning recognition
     */
    public void addToken(Context context, String text)

    /**
     * Delete generated token
     *
     * @param context  Context
     * @param position token index
     */
    public void delToken(Context context, int position)

    /**
     * Edit basic information of an already generated token
     *
     * @param context  Context
     * @param position Index
     * @param issuer   issuer
     * @param label    label
     * @param image    image
     */
    public void editToken(Context context, int position, String issuer, String label, Uri image)

    /**
     * Delete generated token
     *
     * @param context  Context
     * @param position token index
     */
    public void delToken(Context context, int position)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Token is the core generation class.
TokenCode is the time management class.
TokenPersistence is the code management class.
The SDK has a built-in broadcast constant Constant.ACTION_IMAGE_SAVED. When a new OTP is added, a broadcast will be sent. The caller can listen to this broadcast as needed to refresh the list.
1
2
3
4