This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
developers:examples:java:client-api-basic [2016/10/26 08:12] 127.0.0.1 external edit |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Basic authentication example using Java SDK Client API ====== | ||
- | |||
- | See all [[developers: | ||
- | |||
- | [[https:// | ||
- | |||
- | [[https:// | ||
- | |||
- | [[developers: | ||
- | |||
- | In the following chapter, typical examples of using the ADUCID< | ||
- | |||
- | A typical example of using ADUCID< | ||
- | |||
- | - Creating an authentication session in AIM for the requested operation. The redirect URL with identifier **authId, | ||
- | - <font 11.0pt/ | ||
- | |||
- | === === | ||
- | |||
- | ==== Example of Starting Authentication Session (step 1) ==== | ||
- | |||
- | When authenticating a user, an authentication session must first be created on the AIM server. This is done by the **startAuthenticationSession** operation of the **AducidAdvancedClient** object. It is necessary to provide a return URL as an operation input parameter. The **startAuthenticationSession** operation returns URL, where to redirect to start PEIG authentication handshake. | ||
- | |||
- | This page starts authentication request. As a parameter of **startAuthenticationSession** method we provide URL with final page where authentication is evaluated: | ||
- | <code java> | ||
- | public void authenticate(HttpServletResponse response) throws AducidClientException { | ||
- | AducidAdvancedClient client = new AducidAdvancedClient(" | ||
- | String redirectUrl = client.startAuthenticationSession(" | ||
- | response.sendRedirect(redirectUrl); | ||
- | } | ||
- | </ | ||
- | |||
- | If calling of the **startAuthenticationSession** is successful, no exception is thrown. | ||
- | |||
- | |||
- | ==== Example of Verifying Authentication Session (step 2) ==== | ||
- | |||
- | If authentication has been finished (for example, when the AIM proxy redirects control back to the application, | ||
- | |||
- | <code java> | ||
- | protected GetPSLAttributesResponse authenticateCheck(String authId, String authKey) throws AducidClientException { | ||
- | AducidAdvancedClient client = new AducidAdvancedClient(" | ||
- | GetPSLAttributesResponse authData = client.getResult(authId, | ||
- | // example of method call with verified authentication key | ||
- | List< | ||
- | return authData; | ||
- | } | ||
- | </ | ||
- | |||
- | If calling of the **getResult** | ||
- | |||