private static OrderResponseType Authenticate(string ssn) { using (var client = new RpServicePortTypeClient()) { // RequirementType is optional // This will ensure only mobile BankID can be used // https://www.bankid.com/bankid-i-dina-tjanster/rp-info/guidelines RequirementType conditions = new RequirementType { condition = new[] { new ConditionType() { key = "certificatePolicies", value = new[] { "1.2.3.4.25" } // Mobile BankID } } }; // Set the parameters for the authentication AuthenticateRequestType authenticateRequestType = new AuthenticateRequestType() { personalNumber = ssn, requirementAlternatives = new[] { conditions } }; // ...authenticate return(client.Authenticate(authenticateRequestType)); } }
public CollectResponseType Collect(OrderResponseType order) { using (var client = new RpServicePortTypeClient()) { Console.WriteLine("{0}Start the BankID application and sign in", Environment.NewLine); CollectResponseType result = null; // Wait for the client to sign in do { // ...collect the response result = client.Collect(order.orderRef); Console.WriteLine(result.progressStatus); System.Threading.Thread.Sleep(1000); } while (result.progressStatus != ProgressStatusType.COMPLETE); do { return(result); } while (Console.ReadKey(true).Key != ConsoleKey.Escape); } }
private static void Collect(OrderResponseType order) { using (var client = new RpServicePortTypeClient()) { Console.WriteLine("{0}Start the BankID application and sign in", Environment.NewLine); CollectResponseType result = null; // Wait for the client to sign in do { // ...collect the response result = client.Collect(order.orderRef); Console.WriteLine(result.progressStatus); System.Threading.Thread.Sleep(1000); } while (result.progressStatus != ProgressStatusType.COMPLETE); do { Console.WriteLine("Hi {0}, please press [ESC] to exit", result.userInfo.givenName); } while (Console.ReadKey(true).Key != ConsoleKey.Escape); } }