Single Sign On (SSO) Code

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
aferrara
Ensign (ENS)
Ensign (ENS)
Posts: 2
Joined: Thu Feb 17, 2011 9:14 pm

Single Sign On (SSO) Code

Post by aferrara » Sun May 22, 2011 7:36 am

I have built the following function to accept a user from an external system, and authenticate in AC7 (706 if it matters). This works, but I would like to ask the gurus here if you could advise if this is the appropriate way to handle single sign on. I appreciate all comments.

Code: Select all

                    CommerceBuilder.Users.User loginUser = UserDataSource.LoadForUserName(myUser);
                    if (loginUser != null)
                    {
                        if ((Token.Instance.UserId != loginUser.UserId) && (loginUser.UserId != 0))
                        {
                            //CommerceBuilder.Users.User.Migrate(UserDataSource.Load(loginUser.UserId), Token.Instance.User);
                            CommerceBuilder.Users.User.Migrate(Token.Instance.User, UserDataSource.Load(loginUser.UserId));
                            Token.Instance.UserId = loginUser.UserId;
                            Token.Instance.InitUserContext(loginUser);
                            FormsAuthentication.SetAuthCookie(myUser, false);
                            isSuccess = true;
                        }
                    }
                    else
                    {
                        isSuccess = false;
                    }
Regards,
Art

Post Reply