示例#1
0
 public override void Load()
 {
   Bind<IOAuthContextBuilder>().To<OAuthContextBuilder>();
   var nonceStoreInspector = new NonceStoreInspector(new TestNonceStore());
   var consumerStore = new TestConsumerStore();
   var signatureInspector = new SignatureValidationInspector(consumerStore);
   var consumerValidationInspector = new ConsumerValidationInspector(consumerStore);
   var timestampInspector = new TimestampRangeInspector(new TimeSpan(1,0 , 0));
   var tokenRepository = new TokenRepository();
   var tokenStore = new SampleMemoryTokenStore(tokenRepository);
   var oauthProvider = new OAuthProvider(tokenStore,consumerValidationInspector, nonceStoreInspector,timestampInspector, signatureInspector);
   Bind<IOAuthProvider>().ToConstant(oauthProvider);
   Bind<TokenRepository>().ToConstant(tokenRepository);
 }
示例#2
0
 /// <summary>
 /// Load your modules or register your services here!
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 private static void RegisterServices(IKernel kernel)
 {
     kernel.Bind<IOAuthContextBuilder>().To<OAuthContextBuilder>();
     var nonceStoreInspector = new NonceStoreInspector(new TestNonceStore());
     var consumerStore = new TestConsumerStore();
     var signatureInspector = new SignatureValidationInspector(consumerStore);
     var consumerValidationInspector = new ConsumerValidationInspector(consumerStore);
     var timestampInspector = new TimestampRangeInspector(new TimeSpan(1, 0, 0));
     var tokenRepository = new TokenRepository();
     var tokenStore = new SampleMemoryTokenStore(tokenRepository);
     var oauthProvider = new OAuthProvider(tokenStore, consumerValidationInspector, nonceStoreInspector, timestampInspector, signatureInspector);
     kernel.Bind<IOAuthProvider>().ToConstant(oauthProvider);
     kernel.Bind<TokenRepository>().ToConstant(tokenRepository);
 }