Click here to Skip to main content
15,891,033 members
Articles / Web Development / ASP.NET

Single Sign On (SSO) for cross-domain ASP.NET applications: Part-II - The implementation

Rate me:
Please Sign up or sign in to vote.
4.93/5 (118 votes)
4 Oct 2010CPOL24 min read 558.1K   18.2K   254  
Implementation approach of a domain independent Single Sign On (SSO) for ASP.NET applications.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SSOLib.Service;

namespace SSOLib
{
    public class AuthUtil
    {
        AuthService service = new AuthService();

        public static AuthUtil Instance
        {
            get
            {
                return new AuthUtil();
            }
        }

        /// <summary>
        /// Retrieves the user using the Token
        /// </summary>
        /// <param name="Token"></param>
        /// <returns></returns>
        public WebUser GetUserByToken(string Token)
        {

            WebUser user = service.GetUserByToken(Token);

            return user;
        }

        /// <summary>
        /// Determines whether the current user is logged onto the SSO site
        /// </summary>
        /// <param name="Token"></param>
        /// <returns></returns>
        public bool IsUserLoggedIn(string Token)
        {
            return service.IsUserLoggedIn(Token);
        }

        public UserStatus GetUserStauts(string Token, string RequestId)
        {
            return service.GetUserStauts(Token, RequestId);
        }

        /// <summary>
        /// Checks whether the redirect ID is expired or not
        /// </summary>
        /// <param name="RedirectId"></param>
        /// <returns></returns>
        public bool IsValidRequest(string RequestId)
        {
            return service.IsValidRequest(RequestId);
        }
      
        public WebUser Authenticate(string UserName, string Password)
        {

            WebUser user = service.Authenticate(UserName, Password);

            return user;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder SmartAspects
Bangladesh Bangladesh
I write codes to make life easier, and that pretty much describes me.

Comments and Discussions