public Guid?GetSessionID(string userID, string vendor, string ipAddress) { AuthnRequestType auth = SSOTools.CreateAuthnRequest(userID, vendor, ipAddress); auth.Signature = SSOTools.Sign(auth, auth.ID, _clientCertificate); ChannelFactory <ISSOService> channelFactory = new ChannelFactory <ISSOService>("BasicHttpBinding_ISSOService"); ISSOService ssoClient = channelFactory.CreateChannel(); ResponseType r = ssoClient.GetSSO(new GetSSORequest { AuthnRequest = auth }).Response; channelFactory.Close(); if (SSOTools.VerifySignature(r, _serverCertificate)) { Dictionary <string, string> attributes = SSOTools.GetAttributes(r); Guid cleverDomeSessionGuid = new Guid(attributes["SessionID"]); //int timeOut = int.Parse(attributes["SessionTimeOut"]); // Time Out of the session. return(cleverDomeSessionGuid); } else { return(null); } }
static X509Certificate2 GetClientCertificate() { return(SSOTools.GetCertificate(certPath, certPassword)); }