Search Results :
×WordPress is a free and open-source content management system (CMS) which is used to built websites using templates available in WordPress. One can have secure access into WordPress applications by configuring WordPress Single Sign-On (SSO) using ASP.NET as OAuth Server. By the end of this guide, you would be able to SSO into WordPress using ASP.NET as OAuth Server. To know more about other features we provide in ASP.NET SSO plugin, you can click here.
https://<your-application-url>?ssoaction=config
A] App Login URL:
protected void AuthenticateUser(object sender, EventArgs args)
{
if(User.IsAuthenticated)
{
string redirect_to = "";
HttpCookie cookie = Request.Cookies["authusercookie"];
if (cookie == null)
{
cookie = new HttpCookie("authusercookie");
}
cookie.Values["username"] = encrypt(User.username);
cookie.Values["email"] = encrypt(User.email);
cookie.Values["firstname"] = encrypt(User.firstname);
cookie.Values["lastname"] = encrypt(User.lastname);
cookie.Values["uid"] = encrypt(User.ID);
cookie.Expires = DateTime.UtcNow.AddMinutes(10);
// overwrite the cookie
Response.Cookies.Add(cookie);
if (Session["redirect_to"] != null)
{
redirect_to = Session["redirect_to"].ToString();
Response.Redirect(redirect_to);
Response.End();
}
Session["userauthenticated"] = "true";
if (Session["redirectUrl"] != null)
redirect_to = Session["redirectUrl"].ToString();
Response.Redirect(redirect_to);
Response.End();
}
else
{
Response.Write("Username or Password isinvalid");
Response.End();
}
}
B] Encryption Key:
static public string encrypt(string data)
{
string encryptionKey =
"AudUWDAIm4BC2MijzRKDndSOEJwwdYemGm/hihuchxl5ORgwnuT3mQ==".Trim();
encryptionKey = encryptionKey.Substring(0, 24);
byte[] resultArray;
byte[] inputArray;
inputArray = UTF8Encoding.UTF8.GetBytes(data);
TripleDESCryptoServiceProvider tdes = newTripleDESCryptoServiceProvider();
tdes.Key = UTF8Encoding.UTF8.GetBytes(encryptionKey);
tdes.Mode = CipherMode.ECB;
tdes.Padding = PaddingMode.PKCS7;
ICryptoTransform itrans = tdes.CreateEncryptor();
resultArray = itrans.TransformFinalBlock(inputArray,0,inputArray.Length);
tdes.Clear();
return Convert.ToBase64String(resultArray, 0,resultArray.Length);
}
Application Name: | ASP NET |
Client ID & Secret: | Click here |
Authorize Endpoint: | https://<your-aspnet-app-url>/api/moserver/authorize |
Token Endpoint: | https://<your-aspnet-app-url>/api/moserver/token |
User Info Endpoint: | https://<your-aspnet-app-url>/api/moserver/userinfo |
Scope: | profile, email |
In this Guide, you have successfully configured WordPress Single Sign-On (SSO) using ASP.NET as OAuth Server and WordPress as OAuth Client using our ASP.NET OAuth Server plugin. This solution ensures that you are ready to roll out secure access to your ASP.NET application using your WordPress site credentials within minutes.
Mail us on aspnetsupport@xecurify.com for quick guidance (via email/meeting) on your requirement and our team will help you to select the best suitable solution/plan as per your requirement.
Need Help? We are right here!
Thanks for your inquiry.
If you dont hear from us within 24 hours, please feel free to send a follow up email to info@xecurify.com