This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
developers:integration:wsa [2018/06/27 14:07] tjotov |
developers:integration:wsa [2018/06/27 14:30] tjotov |
||
---|---|---|---|
Line 34: | Line 34: | ||
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); | ||
</ | </ | ||
Line 65: | Line 69: | ||
} | } | ||
</ | </ | ||
- | === Create | + | === Create |
- | + | Just simple " | |
- | On the result page we evaluate the authentication request using aducid.getResult | + | <code 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> | <code csharp> | ||
- | protected void Page_Load(object sender, EventArgs e) | + | var aducid |
- | { | + | //read authId from you session |
- | | + | string authId |
- | var query = HttpUtility.ParseQueryString(queryString); | + | var aducidResult |
- | + | //parse json | |
- | var sb = new StringBuilder(); | + | dynamic aducidResultObj = JsonConvert.DeserializeObject(aducidResult); |
- | var aducid = new AducidApiServiceClient(); | + | //User primary key i.e. UDI |
- | try | + | var udi = aducidResultObj.data.userDatabaseIndex; |
- | { | + | //key to further ADUCID operetions on user object (with authId) |
- | | + | string authKey2 = aducidResultObj.data.authKey2; |
- | sb.Append("< | + | //prepare response |
- | | + | var response = aducid.endAuthenticationSession(authId, authKey2); |
- | sb.Append("< | + | context.Response.ContentType = "text/plain"; |
- | sb.Append("< | + | //OK do something with your session |
- | sb.Append("< | + | //... |
- | sb.Append("< | + | //send response |
- | | + | context.Response.Write(response); |
- | + | ||
- | sb.Append("< | + | |
- | + | ||
- | } | + | |
- | catch (Exception ee) | + | |
- | { | + | |
- | sb.Append(" | + | |
- | } | + | |
- | | + | |
- | } | + | |
</ | </ | ||
Line 105: | Line 107: | ||
This page should contain [[integration-api: | This page should contain [[integration-api: | ||
Provide start, check and proxy Url. | Provide start, check and proxy Url. | ||
- | aducid.setStartOperationUrl(" | + | aducid.setStartOperationUrl(" |
- | | + | |
- | | + | |
+ | Override what should be done after authentication / operation: | ||
+ | | ||
+ | if (result.status == " | ||
+ | alert(" | ||
+ | // | ||
+ | } | ||
+ | else { | ||
+ | alert(" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | And create some HTML eleemts: | ||
+ | |||
+ | <code html> | ||
+ | < | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | |||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div id=" | ||
+ | </ | ||
+ | </ | ||
+ | <div class=" | ||
+ | <img id=" | ||
+ | </ | ||
+ | |||
+ | <div class=" | ||
+ | <div id=" | ||
+ | <div id=" | ||
+ | </ | ||
+ | |||
+ | <div id=" | ||
+ | < | ||
+ | <a class=' | ||
+ | <br /> | ||
+ | <div class=' | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ |