c# - Third Party Authentication Oauth with Adapter Pattern Design -


i writing third party authentication method facebook , google+ currently.

i decided use adapter design pattern , first time following design patterns

here design structure

namespace thirdpartyregister.tests { [testclass] public class thirdpartyregister {     [testmethod]     public void login_test()     {         ithirdpartyauthenticationadapter adapter= new thirdpartyauthenticationadapter(new googleplusauthentication());          var testresult = adapter.login();         assert.isfalse(testresult);     } }  public interface ithirdpartyauthenticationadapter{     bool login();  }  public class thirdpartyauthenticationadapter : ithirdpartyauthenticationadapter {     private readonly ithirdpartyauthenticationadapter _thirdpartyauthentication;      public thirdpartyauthenticationadapter (ithirdpartyauthenticationadapter thirdpartyauthentication){          _thirdpartyauthentication = thirdpartyauthentication;     }      public bool login()     {         return _thirdpartyauthentication.login();     }  }  public class googleplusauthentication : ithirdpartyauthenticationadapter{     public bool login()     {         return false;     } }  public class facebookauthentication : ithirdpartyauthenticationadapter{    public bool login()    {       return true;    } } 

}

my question approach applied above proper? or did miss adapter design pattern


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -