none
Designing an Authentication Service

    Soru

  • Hello,

    I'm designing an authentication service that should be fairly extensible because we're going to reuse it and I'm not quite sure how to keep the interface clean yet allowing support for indefinite amount of errors and stages of the authentication the user might have to go through which might vary from project to project.

    Here is the interface I have.

    [ContractClass(typeof(IAuthenticationServiceContract))]
    	public interface IAuthenticationService
    	{
    		IAuthenticationConfiguration Configuration { get; }
    
    		bool SignIn(string username, string password);
    
    		void SignOut();
    	}

    And here is something I thought of doing.

    [ContractClass(typeof(IAuthenticationServiceContract))]
    	public interface IAuthenticationService
    	{
    		IAuthenticationConfiguration Configuration { get; }
    
    		// IAuthenticationStateCollection States { get; }
    
    		bool SignIn(string username, string password);
    
    		void SignOut();
    	}

    Each state is described using a key, value and a type but I'm not sure that it's the best way to go with, has anyone done something similar that should handle an indefinite amount of states ? how did you solve it ?


    Eyal (http://shilony.net), Regards.



    • Düzenleyen Eyal Shilony 07 Mart 2012 Çarşamba 02:49
    • Taşıyan Lie You 12 Mart 2012 Pazartesi 05:44 Move it for better support. (From:Visual C# General)
    07 Mart 2012 Çarşamba 02:45

Yanıtlar

Tüm Yanıtlar

  • I presume you are using WCF for it.

    I suggest you go through ASP.NET Authentication Service exposing using WCF.

    (it is having the ValidateUser() method - so no reinventing the wheels :))

    The Authentication Service is extensible and you can use a custom database for user/pwd validations.

    You can find a good article here.

    http://msdn.microsoft.com/en-us/library/ff406125.aspx



    Resolving n Evolving in C# (http://jeanpaulva.com)

    07 Mart 2012 Çarşamba 08:01
  • Hey,

    I should have said that it's not a WCF service. ;)

    Well, to be honest I didn't even think about doing that in WCF because I'll have to introduce new codebase to adapt everything so it's out of the question, at least for the moment, thank you for suggesting it though.

    I don't want to use the existing MembershipProvider because there's a lot of noise there and I really don't like the design of this, not sure why they made it so rigid, more specifically I am talking about the User class, it's possible to extend it but there's so many details that are likely to change, I can probably wrap it up but it's not something I want to do so I prefer to roll my own.

    Hopefully it makes sense. ;)


    Eyal (http://shilony.net), Regards.



    07 Mart 2012 Çarşamba 09:54
  • Can a moderator move it to the "Architecture General" forum ?

    I posted it here because there's no much movement in this forum even though it's more appropriate, sorry. ;)


    Eyal (http://shilony.net), Regards.

    07 Mart 2012 Çarşamba 18:28
  • I would help you to move it there. Sorry for the late response.

    Thanks for your understanding and support.


    Best Regards,
    Rocky Yue[MSFT]
    MSDN Community Support | Feedback to us

    12 Mart 2012 Pazartesi 05:43
  • This thread is no longer relevant to my case.

    Eyal (http://shilony.net), Regards.


    • Düzenleyen Eyal Shilony 26 Nisan 2012 Perşembe 03:59
    • Yanıt Olarak İşaretleyen Eyal Shilony 26 Nisan 2012 Perşembe 03:59
    26 Nisan 2012 Perşembe 03:58