Forums & Blog

A SmarterTools-sponsored community.
Welcome to Forums & Blog Sign in | Join | Help
in Search

How-To: Creating a custom web service provider for logins

Last post 12-08-2008 3:54 PM by aristotle. 37 replies.
Page 3 of 3 (38 items) < Previous 1 2 3
Sort Posts: Previous Next
  • 06-27-2008 6:20 AM In reply to

    Re: How-To: Creating a custom web service provider for logins

    Hi Grady,

    Any update on this single sign-on web service for SmarterTrack?  We, too, would use it as DanBartels has described; specifically the Active Directory portion.

    Thanks,
    Paul

    Currently running STrack Pro 3.6.3246, SMail Pro 5.5.3223, SStats 4.0.3217
  • 07-01-2008 12:54 AM In reply to

    Re: How-To: Creating a custom web service provider for logins

    Is it possible to create a web service for Login that authenticates users from a MySQL table ? 

  • 07-01-2008 3:24 PM In reply to

    Re: How-To: Creating a custom web service provider for logins

    ST-GWerner:

    Very good point.  I've asked the dev team to alter the next build to allow custom field items to be pre-set by the GetCustomFieldOptions method.  Once that's in track, you'll be able to do:

    OutputVariables.Add("cf_MyCustomField=Big Joe");

    Hi Grady, in a previous post you thought the pre-set field option would be included, so you know if it made it to the 3.5 beta? I've downloaded it and can't get the option to work...

    If I follow your example I get a null reference error (see below) - if I drop off the "cf_" prefix when adding the output variable I get no error (which also doesn't work)...

    P.S. When setting a drop down field using the previous CustomFieldDataItems.Add code you can only get it to work if you use the fields name as defined in the template section rather than the display name set under the field defination - is this by design? I would have imagined the field def. name should be consistant across all code so to allow the display name as set in the template to be able to vary...

    TJ

    ***************** Error Info ***********************

    Server Error in '/SmarterTrack' Application.
    --------------------------------------------------------------------------------

    Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

    Stack Trace:


    [NullReferenceException: Object reference not set to an instance of an object.]
       SmarterTrack.MRS.Main.frmNewTicket.CallCustomFieldProvider(DepartmentEntity dept, Boolean Pre, String& message) +930
       SmarterTrack.MRS.Main.frmNewTicket.DepartmentNextIcon_Click(Object sender, EventArgs e) +152
       SmarterTools.Web.Controls.SimpleButton.RaisePostBackEvent(String eventArgument) +58
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1546
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.3031; ASP.NET Version:2.0.50727.3031

     

  • 07-07-2008 4:31 AM In reply to

    • fatuma
    • Not Ranked
    • Joined on 07-07-2008
    • Posts 1

    Re: How-To: Creating a custom web service provider for logins

     

    I have created new web service for the smarter track authentication and included MySmarterTrackProvider.asmx and MySmarterTrackProvider.asmx.cs from your sample code and modified the Authenticate method as our requirement to validate user information fom the database and hosted the web service you can check it the following address

     http://ws.escridoc.com/MySmarterTrackProvider.asmx

    and here is the method that I have modified

     [WebMethod]
            public ExternalLoginProviderResult Authenticate(ExternalLoginProviderInputs inputs)
            {
                ParsedLoginInputData iData = new ParsedLoginInputData(inputs);
                ExternalLoginProviderResult result;

                // Verify that all necessary criteria to call this function are met
                if (iData.WebServiceAuthorizationCode != WebServicePassword)
                    return new ExternalLoginProviderResult(false, "Permission Denied");
                if (string.IsNullOrEmpty(iData.LoginUsername) || string.IsNullOrEmpty(iData.LoginPassword))
                    return new ExternalLoginProviderResult(false, "Required Input Missing");
                //============check the user account is valid or not===========//
                SqlConnection conn = new SqlConnection(WebConfigurationManager.AppSettings["dbConnection"].ToString());
                SqlCommand cmd = new SqlCommand("IsSubsciberUser", conn);
                cmd.CommandType = CommandType.StoredProcedure;

               cmd.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar, 50));
               cmd.Parameters["@Email"].Value = iData.LoginUsername.ToLowerInvariant() ;
               cmd.Parameters.Add(new SqlParameter("@Password", SqlDbType.VarChar, 50));
               cmd.Parameters["@Password"].Value = iData.LoginPassword.ToString() ;
               conn.Open();
               bool isvaliduser = Convert.ToInt32(cmd.ExecuteScalar()) == 1 ? true : false;
               conn.Dispose();
                //====================================//
                //iData.LoginUsername.ToLowerInvariant() == "myusername" && iData.LoginPassword.ToLowerInvariant() == "mypassword"
                // This is a sample of how to do a basic username/password check (use your own database or list here)
                if (isvaliduser)
                {
                    result = new ExternalLoginProviderResult();
                    result.Success = true;
                    result.Message = "Login Successful";
                    result.OutputVariables.Add("Authentication=OK");
                    result.OutputVariables.Add("EmailAddress=putUsersEmailAddressHere@example.com"); // optional
                    result.OutputVariables.Add("DisplayName=putUsersFullNameHere"); // optional
                    return result;
                }

                // Below is a sample Active Directory Authentication implementation
                //string[ unDomainUsernameSplit = loginUsername.Split(new char[ { '/', '\\' }, 2);
                //if (unDomainUsernameSplit.Length == 2)
                //{
                //    if (LDAP.AuthenticateLogin(unDomainUsernameSplit[0], unDomainUsernameSplit[1],
                //        loginPassword, LDAP.NetworkType.ActiveDirectory) == LDAP.LDAPResult.Authenticated)
                //    {
                //        return new ExternalLoginProviderResult(true, "Login Successful", "Authentication=OK");
                //    }
                //}

                // Return a failure if there's no match
                return new ExternalLoginProviderResult(true, "Login Failure", "Authentication=FAIL");
            }
     

     And assigned the address for the smarter track to use our web service like this (http://ws.escridoc.com/MySmarterTrackProvider.asmx), but now the problem is when we are trying to login via the smarter tracker to test it doesn’t work and display error s

    please could help me what  I have missed in the web service ,please check the above code and give me your valuable support ?

    Also if possible you can replay your answer using my e-mail address here is the address fatuma2005@gmail.com

    thanks in advance 

     

  • 07-09-2008 3:44 AM In reply to

    Re: How-To: Creating a custom web service provider for logins

    I need one for MySQL for login authentication.

    Does someone have it ?

  • 09-17-2008 12:28 PM In reply to

    Re: How-To: Creating a custom web service provider for logins

    I'm currently evaluating SmarterTrack and have spent much of today trying to get the custom login working, but without success.  Here's my scenario:

    I have our main site (www.oursite.com) which already has profile, membership, and role providers in place.  The SmarterTrack is begin set up as (support.oursite.com).  I want to reuse our existing user validation mechaisms for single sign on.

    So in the SmarterTrack options I did these:

    1) "Customer Portal / Options / Authentication" is set to None.  "Enable new user registration" is unchecked on that page too.

    2) "External Providers / Login Provider" page has these settings:

    3) Then I took the MySmarterTrackProvider.asmx from this thread and published that properly however commented out the user verification in Authenticate and GetSignInCookieInfo so that it will always return the success case.

    Ok now the issue, when I log in using the SmarterTrack /Login.aspx page as my sys admin account, I can see everything fine on the customer portal.  If I try and log in via our main web site instead and go to the customer portal page, it seems to only think I'm anonymous and doesn't allow for submission of tickets.

    Any ideas where I've gone wrong?  I've burned several hours on this today already.  Thanks in advance!

    UPDATE: I found the problem, it was my "Customer Portal / Options / Authentication" option.

     

  • 11-12-2008 1:42 PM In reply to

    • Jeff T
    • Not Ranked
    • Joined on 11-11-2008
    • Posts 5

    Re: How-To: Creating a custom web service provider for logins

     bhenning.

     Thanks. This is helpful. I'm still struggling with how to pass the login/password info across, but this is a good start. Will give it another go tomorrow when I've got fresh eyes again...

     

    Cheers,

    Jeff

  • 12-08-2008 3:54 PM In reply to

    Re: How-To: Creating a custom web service provider for logins

    How do you set a custom field that is a checkbox (boolean)?

    I've tried:

    OutputVariables.Add("cf_MyField=1")
    OutputVariables.Add("cf_MyField=true")
    OutputVariables.Add("cf_MyField=checked")

    but none seem to work.

     

Page 3 of 3 (38 items) < Previous 1 2 3