This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
developers:integration:wsa [2018/06/27 14:06] tjotov |
developers:integration:wsa [2019/08/01 10:07] tjotov removed |
||
---|---|---|---|
Line 4: | Line 4: | ||
* [[developers: | * [[developers: | ||
* [[integration-api: | * [[integration-api: | ||
- | * | + | |
For detailed methods / classes / types description see [[http:// | For detailed methods / classes / types description see [[http:// | ||
Line 26: | Line 26: | ||
=== Import WSDL into your project in Visual Studio. === | === Import WSDL into your project in Visual Studio. === | ||
- | Create an instance of **AducidApiServiceClient | + | Create an instance of **AducidApiJsonServiceClient**. |
=== Create a start operation Url === | === Create a start operation Url === | ||
This page starts authentication request. | This page starts authentication request. | ||
- | <code csharp> | + | <sxh csharp> |
var aducid = new AducidApiJsonServiceClient(); | var aducid = new AducidApiJsonServiceClient(); | ||
string host = " | string host = " | ||
- | |||
string query = context.Request.QueryString.ToString(); | string query = context.Request.QueryString.ToString(); | ||
var queryParsed = HttpUtility.ParseQueryString(query); | var queryParsed = HttpUtility.ParseQueryString(query); | ||
var generateQr = queryParsed[" | var generateQr = queryParsed[" | ||
var arg = new OperationArgument(); | var arg = new OperationArgument(); | ||
+ | //return URL for iOS | ||
arg.peigReturnName = host + "/ | arg.peigReturnName = host + "/ | ||
+ | //QR code picture size | ||
arg.qrCodePictureHeight = 300; | arg.qrCodePictureHeight = 300; | ||
arg.qrCodePictureWidth = 300; | arg.qrCodePictureWidth = 300; | ||
+ | //tab helper If - if more authentication are in web browser in more tabs this help ti identify them - has to be unique | ||
arg.id = " | arg.id = " | ||
arg.generateQrCodePicture = generateQr == " | arg.generateQrCodePicture = generateQr == " | ||
+ | //JSON response from WSA | ||
var response = aducid.startAuthenticationSession(JsonConvert.SerializeObject(arg)); | var response = aducid.startAuthenticationSession(JsonConvert.SerializeObject(arg)); | ||
+ | //parse and store authId | ||
dynamic responseObj = JsonConvert.DeserializeObject(response); | dynamic responseObj = JsonConvert.DeserializeObject(response); | ||
- | + | // | |
- | Console.WriteLine(responseObj.data.authId); | + | |
context.Session[" | context.Session[" | ||
context.Response.ContentType = " | context.Response.ContentType = " | ||
+ | //send response | ||
context.Response.Write(response); | context.Response.Write(response); | ||
- | </code> | + | </sxh> |
- | === Create | + | OperationArgument is a simple object |
- | + | <sxh csharp> | |
- | On the result page we evaluate the authentication request using aducid.getResult | + | public class OperationArgument |
+ | { | ||
+ | public String peigReturnName { get; set; } | ||
+ | public int qrCodePictureHeight { get; set; } | ||
+ | public int qrCodePictureWidth { get; set; } | ||
+ | public String id { get; set; } | ||
+ | public Boolean generateQrCodePicture { get; set; } | ||
+ | } | ||
+ | </ | ||
+ | === Create | ||
+ | Just simple " | ||
+ | <sxh csharp> | ||
+ | var aducid | ||
+ | string host = " | ||
+ | var response = aducid.getStatus((string)context.Session[" | ||
+ | context.Response.ContentType = " | ||
+ | context.Response.Write(response); | ||
+ | </ | ||
+ | === Create check Url === | ||
+ | On the result page we evaluate the authentication | ||
There are two basic results – authentication is OK or an error is thrown: | There are two basic results – authentication is OK or an error is thrown: | ||
- | <code csharp> | + | <sxh csharp> |
- | protected void Page_Load(object sender, EventArgs e) | + | var aducid = new AducidApiJsonServiceClient(); |
- | { | + | //read authId from you session |
- | var queryString | + | string authId |
- | var query = HttpUtility.ParseQueryString(queryString); | + | var aducidResult |
- | + | //parse json | |
- | var sb = new StringBuilder(); | + | dynamic aducidResultObj |
- | var aducid | + | //User primary key i.e. UDI |
- | try | + | var udi = aducidResultObj.data.userDatabaseIndex; |
- | { | + | //key to further ADUCID operetions on user object |
- | | + | string authKey2 = aducidResultObj.data.authKey2; |
- | sb.Append("< | + | //prepare response |
- | | + | var response |
- | | + | context.Response.ContentType |
- | sb.Append("< | + | //OK do something with your session |
- | sb.Append("< | + | //... |
- | sb.Append("< | + | //send response |
- | | + | context.Response.Write(response); |
+ | </sxh> | ||
- | sb.Append("</ | ||
+ | === Prepare a web page === | ||
+ | This page should contain [[integration-api: | ||
+ | Provide start, check and proxy Url. | ||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | Override what should be done after authentication / operation: | ||
+ | < | ||
+ | | ||
+ | if (result.status == " | ||
+ | alert(" | ||
+ | // | ||
+ | } | ||
+ | else { | ||
+ | alert(" | ||
+ | } | ||
} | } | ||
- | catch (Exception ee) | + | </sxh> |
- | { | + | |
- | sb.Append(" | + | |
- | } | + | |
- | lResponse.Text = sb.ToString(); | + | |
- | } | + | |
- | </code> | + | |
+ | And create some HTML elements: | ||
- | === Prepare a web page === | + | <sxh html> |
- | This page should contain [[integration-api: | + | < |
- | Provide start, check and proxy Url. | + | <div class=" |
- | aducid.setStartOperationUrl("myOpen"); | + | <div class=" |
- | aducid.setResultOperationUrl("myPpenCheck"); | + | |
- | aducid.setProxyUrl("myProxy"); | + | <div class=" |
+ | <div class=" | ||
+ | <div id=" | ||
+ | </ | ||
+ | </ | ||
+ | <div class=" | ||
+ | <img id="qr-code" alt="" | ||
+ | </ | ||
+ | |||
+ | <div class="row text-center"> | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <div id=" | ||
+ | < | ||
+ | <a class=' | ||
+ | <br /> | ||
+ | <div class=' | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ |