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:04] 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(); | ||
+ | var queryParsed = HttpUtility.ParseQueryString(query); | ||
+ | var generateQr = queryParsed[" | ||
+ | var arg = new OperationArgument(); | ||
+ | //return URL for iOS | ||
+ | arg.peigReturnName = host + "/ | ||
+ | //QR code picture size | ||
+ | arg.qrCodePictureHeight = 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.generateQrCodePicture = generateQr == " | ||
- | string query = context.Request.QueryString.ToString(); | + | //JSON response from WSA |
- | var queryParsed | + | var response |
- | var generateQr = queryParsed["generateQrCodePicture"]; | + | //parse and store authId |
- | var arg = new OperationArgument(); | + | dynamic responseObj |
- | arg.peigReturnName | + | //store authId in your session |
- | | + | context.Session["123"] = (string) responseObj.data.authId; |
- | arg.qrCodePictureWidth = 300; | + | context.Response.ContentType |
- | arg.id = " | + | //send response |
- | | + | context.Response.Write(response); |
+ | </ | ||
- | | + | OperationArgument is a simple object |
- | | + | <sxh csharp> |
+ | 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 WSA proxy === | ||
+ | Just simple " | ||
+ | <sxh csharp> | ||
+ | var aducid = new AducidApiJsonServiceClient(); | ||
+ | string host = " | ||
+ | var response = aducid.getStatus((string)context.Session[" | ||
+ | context.Response.ContentType | ||
+ | context.Response.Write(response); | ||
+ | </ | ||
- | Console.WriteLine(responseObj.data.authId); | + | === Create check Url === |
- | context.Session[" | + | On the result page we evaluate the authentication |
- | context.Response.ContentType | + | There are two basic results – authentication is OK or an error is thrown: |
- | context.Response.Write(response); | + | |
- | } | + | |
- | </ | + | |
- | === Create check result Url === | + | <sxh csharp> |
+ | var aducid | ||
+ | //read authId from you session | ||
+ | string authId | ||
+ | var aducidResult | ||
+ | //parse json | ||
+ | dynamic aducidResultObj | ||
+ | //User primary key i.e. UDI | ||
+ | var udi = aducidResultObj.data.userDatabaseIndex; | ||
+ | //key to further ADUCID operetions on user object (with authId) | ||
+ | string authKey2 | ||
+ | //prepare response | ||
+ | var response = aducid.endAuthenticationSession(authId, | ||
+ | context.Response.ContentType = " | ||
+ | //OK do something with your session | ||
+ | //... | ||
+ | //send response | ||
+ | context.Response.Write(response); | ||
+ | </ | ||
- | On the result page we evaluate the authentication request using aducid.getResult | ||
- | There are two basic results – authentication | + | === Prepare a web page === |
+ | This page should contain [[integration-api: | ||
+ | Provide start, check and proxy Url. | ||
+ | <sxh> | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | Override what should be done after authentication | ||
+ | <sxh> | ||
+ | | ||
+ | if (result.status == " | ||
+ | alert(" | ||
+ | // | ||
+ | } | ||
+ | else { | ||
+ | alert(" | ||
+ | } | ||
+ | } | ||
+ | </ | ||
- | <code csharp> | + | And create some HTML elements: |
- | protected void Page_Load(object sender, EventArgs e) | + | |
- | { | + | |
- | var queryString = HttpContext.Current.Request.Url.Query; | + | |
- | var query = HttpUtility.ParseQueryString(queryString); | + | |
- | var sb = new StringBuilder(); | + | <sxh html> |
- | var aducid = new AducidApiServiceClient(); | + | <h1>ADUCID Hello World example</h1> |
- | try | + | <div class="row"> |
- | { | + | <div class="col-xs-8 col-xs-offset-2"> |
- | var result = aducid.getResult(query.Get(" | + | |
- | sb.Append(" | + | |
- | | + | |
- | | + | |
- | | + | |
- | sb.Append("< | + | |
- | sb.Append("< | + | |
- | sb.Append("< | + | |
- | | + | |
+ | <div class=" | ||
+ | <div id=" | ||
+ | </ | ||
+ | </ | ||
+ | <div class="row"> | ||
+ | <img id=" | ||
+ | </ | ||
- | } | + | <div class="row text-center"> |
- | catch (Exception ee) | + | < |
- | { | + | < |
- | sb.Append("Error:" | + | </ |
- | } | + | |
- | lResponse.Text | + | |
- | } | + | |
- | </code> | + | |
- | + | ||
- | + | ||
- | === Prepare a web page === | + | |
- | This page should contain [[integration-api: | + | |
- | Provide start, check and proxy Url. | + | |
- | | + | |
- | | + | |
- | aducid.setProxyUrl(" | + | |
+ | <div id=" | ||
+ | < | ||
+ | <a class=' | ||
+ | <br /> | ||
+ | <div class=' | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ |