This guide provides steps to enable SP-initiated SSO for custom .NET applications via the OpenID Connect protocol using ManageEngine ADSelfService Plus' SSO feature. The steps have been detailed for the understanding of a system administrator with knowledge of Microsoft Windows, Microsoft Visual Studio, and .NET. The solution supports SSO configuration for enterprise and custom applications supporting SAML, OAuth, and OpenID Connect applications. Once this feature is configured, when users access the .NET application, they will be redirected to ADSelfService Plus and will have to complete authentication.
<appSettings> <add key="adssp:ClientId" value="clientID" /> <add key="adssp:ClientSecret" value="clientkey" /> <add key="adssp:OrgUri" value="https://organization-url" /> <add key="adssp:RedirectUri" value="https://redirect-url" /> <add key="adssp:WellKnownConfigUri" value="https://wellKnownConfiguration" /> </appSettings>
Here, in place of
using Microsoft.Owin;
using Owin;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using Microsoft.IdentityModel.Tokens;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using System.Configuration;
using Microsoft.AspNet.Identity;
using Microsoft.Owin.Security.OpenIdConnect;
public class Startup { // These values are stored in Web.config. Make sure you update them. private readonly string _clientId = ConfigurationManager .AppSettings["adssp:ClientId"]; private readonly string _redirectUri = ConfigurationManager .AppSettings["adssp:RedirectUri"]; private readonly string _authority = ConfigurationManager .AppSettings["adssp:OrgUri"]; private readonly string _clientSecret = ConfigurationManager .AppSettings["adssp:ClientSecret"]; private readonly string _wellKnownConfigUri = ConfigurationManager .AppSettings["adssp:WellKnownConfigUri"]; public void Configuration(IAppBuilder app) { ConfigureAuth(app); } public void ConfigureAuth(IAppBuilder app) { app.UseExternalSignInCookie(DefaultAuthenticationTypes .ExternalCookie); app.SetDefaultSignInAsAuthenticationType (CookieAuthenticationDefaults .AuthenticationType); app.UseCookieAuthentication(new CookieAuthenticationOptions()); app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions { ClientId = _clientId, ClientSecret = _clientSecret, Authority = _authority, RedirectUri = _redirectUri, MetadataAddress = _wellKnownConfigUri, ResponseType = OpenIdConnectResponseType.CodeIdToken, Scope = OpenIdConnectScope.OpenIdProfile, TokenValidationParameters = new TokenValidationParameters { NameClaimType = "name" }, Notifications = new OpenIdConnectAuthenticationNotifications { AuthorizationCodeReceived = async n => { // Exchange code for fetching access token }, }, }); } }
//Alter Site.Master file to add login and logout button to the default view template <asp:LoginView runat="server" ViewStateMode="Disabled"> <AnonymousTemplate> <ul class="nav navbar-nav navbar-right"> <li> <a href="Site.Master" runat="server" onserverclick="login_init">Log In</a> </li> </ul> </AnonymousTemplate> <LoggedInTemplate> <ul class="nav navbar-nav navbar-right"> <li> <asp:LoginStatus runat="server" LogoutAction="Redirect" LogoutText="Log off" LogoutPageUrl="~/" OnLoggingOut="logout_init" /> </li> </ul> </LoggedInTemplate> </asp:LoginView>
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.OpenIdConnect;
using Microsoft.AspNet.Identity;
//Add the below methods to capture login and logout events triggered from Site.Master.cs protected void login_init(object sender, EventArgs e) { if (!Request.IsAuthenticated) { HttpContext.Current.GetOwinContext().Authentication.Challenge( new AuthenticationProperties { RedirectUri = "/" }, OpenIdConnectAuthenticationDefaults.AuthenticationType); } } protected void logout_init(object sender, LoginCancelEventArgs e) { Context.GetOwinContext().Authentication.SignOut(DefaultAutie); }
SSO is now enabled for the custom .NET application. Users need to only login once to access the custom .NET application and other enterprise applications. To secure the login process, MFA can be enabled using authenticators such as biometrics, Google Authenticator, and Azure AD MFA.
Need further assistance? Fill this form, and we'll contact you rightaway.
Free Active Directory users from attending lengthy help desk calls by allowing them to self-service their password resets/ account unlock tasks. Hassle-free password change for Active Directory users with ADSelfService Plus ‘Change Password’ console.
Get seamless one-click access to 100+ cloud applications. With enterprise single sign-on, users can access all their cloud applications with their Active Directory credentials. Thanks to ADSelfService Plus!
Intimate Active Directory users of their impending password/account expiry by mailing them these password/account expiry notifications.
Synchronize Windows Active Directory user password/account changes across multiple systems, automatically, including Office 365, G Suite, IBM iSeries and more.
Ensure strong user passwords that resist various hacking threats with ADSelfService Plus by enforcing Active Directory users to adhere to compliant passwords via displaying password complexity requirements.
Portal that lets Active Directory users update their latest information and a quick search facility to scout for information about peers by using search keys, like contact number, of the personality being searched.