本文整理汇总了C#中IAppBuilder.UseIdentityServer方法的典型用法代码示例。如果您正苦于以下问题:C# IAppBuilder.UseIdentityServer方法的具体用法?C# IAppBuilder.UseIdentityServer怎么用?C# IAppBuilder.UseIdentityServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAppBuilder
的用法示例。
在下文中一共展示了IAppBuilder.UseIdentityServer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configuration
public void Configuration(IAppBuilder app)
{
// tracing
Log.Logger = new LoggerConfiguration()
.WriteTo.Trace()
.CreateLogger();
// in-memory datenhaltung für users, scopes, clients und CORS policys
var users = new InMemoryUserService(Users.Get());
var scopes = new InMemoryScopeStore(Scopes.Get());
var clients = new InMemoryClientStore(Clients.Get());
var cors = new InMemoryCorsPolicyService(Clients.Get());
// konfigurieren der factory
var factory = new IdentityServerServiceFactory();
factory.UserService = new Registration<IUserService>(users);
factory.ScopeStore = new Registration<IScopeStore>(scopes);
factory.ClientStore = new Registration<IClientStore>(clients);
factory.CorsPolicyService = new Registration<ICorsPolicyService>(cors);
// identityserver3 middleware einbinden
app.UseIdentityServer(new IdentityServerOptions
{
Factory = factory,
SiteName = "DotNetPro IdentityServer",
SigningCertificate = Certificate.Get()
});
}
示例2: Configuration
public void Configuration(IAppBuilder app)
{
var connectionString = "MembershipReboot";
app.Map("/admin", adminApp =>
{
var factory = new IdentityManagerServiceFactory();
factory.Configure(connectionString);
adminApp.UseIdentityManager(new IdentityManagerOptions()
{
Factory = factory
});
});
var idSvrFactory = Factory.Configure();
idSvrFactory.ConfigureCustomUserService(connectionString);
var options = new IdentityServerOptions
{
IssuerUri = "https://idsrv3.com",
SiteName = "Thinktecture IdentityServer3 - UserService-MembershipReboot",
SigningCertificate = Certificate.Get(),
Factory = idSvrFactory,
CorsPolicy = CorsPolicy.AllowAll,
AuthenticationOptions = new AuthenticationOptions{
IdentityProviders = ConfigureAdditionalIdentityProviders,
}
};
app.UseIdentityServer(options);
}
示例3: Configuration
public void Configuration(IAppBuilder app)
{
// Configuring logging
LogProvider.SetCurrentLogProvider(new DiagnosticsTraceLogProvider());
// Configuring thinktecture identity manager
app.Map("/admin", adminApp =>
{
var adminFactory = new IdentityManagerServiceFactory();
adminFactory.ConfigureSimpleIdentityManagerService();
adminApp.UseIdentityManager(new IdentityManagerOptions
{
Factory = adminFactory
});
});
// Configuring thinktecture auth server with Asp.Net identity
var factory = Factory.Configure();
factory.ConfigureCustomServices();
var options = new IdentityServerOptions
{
SiteName = "My Auth Server",
RequireSsl = false,
SigningCertificate = Certificate.Load(),
Factory = factory,
CorsPolicy = CorsPolicy.AllowAll
};
app.UseIdentityServer(options);
}
示例4: Configuration
public void Configuration(IAppBuilder appBuilder)
{
var factory = InMemoryFactory.Create(
users: Users.Get(),
clients: Clients.Get(),
scopes: Scopes.Get());
factory.ClaimsProvider =
new Registration<IClaimsProvider>(typeof(CustomClaimsProvider));
factory.UserService =
new Registration<IUserService>(typeof(CustomUserService));
factory.CustomGrantValidator =
new Registration<ICustomGrantValidator>(typeof(CustomGrantValidator));
var options = new IdentityServerOptions
{
IssuerUri = "https://idsrv3.com",
SiteName = "Thinktecture IdentityServer3 (CustomGrants)",
RequireSsl = false,
SigningCertificate = Certificate.Get(),
Factory = factory,
};
appBuilder.UseIdentityServer(options);
}
示例5: Configuration
public void Configuration(IAppBuilder appBuilder)
{
Log.Logger = new LoggerConfiguration()
.WriteTo.ColoredConsole(
outputTemplate: "{Timestamp:HH:mm} [{Level}] ({Name}) {NewLine} {Message}{NewLine}{Exception}")
.CreateLogger();
LogProvider.SetCurrentLogProvider(new SerilogLogProvider());
var factory = InMemoryFactory.Create(
users: Users.Get(),
clients: Clients.Get(),
scopes: Scopes.Get());
var options = new IdentityServerOptions
{
IssuerUri = "https://idsrv3.com",
SiteName = "Thinktecture IdentityServer3 (self host)",
SigningCertificate = Certificate.Get(),
Factory = factory,
};
appBuilder.UseIdentityServer(options);
}
示例6: Configuration
public void Configuration(IAppBuilder appBuilder)
{
Log.Logger = new LoggerConfiguration()
.WriteTo.Trace(outputTemplate: "{Timestamp} [{Level}] ({Name}){NewLine} {Message}{NewLine}{Exception}")
.CreateLogger();
appBuilder.Map("/windows", ConfigureWindowsTokenProvider);
var factory = new IdentityServerServiceFactory()
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get());
factory.UserService = new Registration<IUserService>(typeof(ExternalRegistrationUserService));
var options = new IdentityServerOptions
{
SigningCertificate = Certificate.Load(),
Factory = factory,
AuthenticationOptions = new AuthenticationOptions
{
EnableLocalLogin = false,
IdentityProviders = ConfigureIdentityProviders
}
};
appBuilder.UseIdentityServer(options);
}
示例7: Configuration
public void Configuration(IAppBuilder appBuilder)
{
var factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryScopes(Scopes.Get())
.UseInMemoryClients(Clients.Get());
factory.ClaimsProvider =
new Registration<IClaimsProvider>(typeof(CustomClaimsProvider));
factory.UserService =
new Registration<IUserService>(typeof(CustomUserService));
factory.CustomGrantValidators.Add(
new Registration<ICustomGrantValidator>(typeof(CustomGrantValidator)));
var options = new IdentityServerOptions
{
SiteName = "IdentityServer3 (CustomGrants)",
RequireSsl = false,
SigningCertificate = Certificate.Get(),
Factory = factory,
};
appBuilder.UseIdentityServer(options);
}
示例8: Configuration
public void Configuration(IAppBuilder app)
{
var config = new HttpConfiguration();
WebApiConfig.Register(config);
app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
{
Authority = "http://localhost:52401",//Your url here
RequiredScopes = new[] {"api"}
});
app.UseWebApi(config);
var factory = InMemoryFactory.Create(Config.GetUsers().ToList(), Config.GetClients(), Config.GetScopes());
app.UseIdentityServer(new IdentityServerOptions
{
IssuerUri = "urn:identity",
Factory = factory,
RequireSsl = false, //DO NOT DO THIS IN PRODUCTION
LoggingOptions = new LoggingOptions
{
EnableWebApiDiagnostics = true,
WebApiDiagnosticsIsVerbose = true
},
SigningCertificate = LoadCertificate()
});
app.UseNLog();
}
示例9: Configuration
public void Configuration(IAppBuilder app)
{
app.Map("/admin", adminApp =>
{
var factory = new IdentityManagerServiceFactory();
factory.ConfigureSimpleIdentityManagerService("AspId");
//factory.ConfigureCustomIdentityManagerServiceWithIntKeys("AspId_CustomPK");
adminApp.UseIdentityManager(new IdentityManagerOptions()
{
Factory = factory
});
});
var idSvrFactory = Factory.Configure();
idSvrFactory.ConfigureUserService("AspId");
//idSvrFactory.ConfigureCustomUserService("AspId_CustomPK");
var options = new IdentityServerOptions
{
SiteName = "Thinktecture IdentityServer3 - UserService-AspNetIdentity",
SigningCertificate = Certificate.Get(),
Factory = idSvrFactory,
CorsPolicy = CorsPolicy.AllowAll,
AuthenticationOptions = new AuthenticationOptions
{
IdentityProviders = ConfigureAdditionalIdentityProviders,
}
};
app.UseIdentityServer(options);
}
示例10: Configuration
public void Configuration(IAppBuilder app)
{
var connString = "AspId";
//var connString = "CustomAspId";
app.Map("/admin", adminApp =>
{
var factory = new AspNetIdentityIdentityManagerFactory(connString);
adminApp.UseIdentityManager(new IdentityManagerConfiguration()
{
IdentityManagerFactory = factory.Create
});
});
var options = new IdentityServerOptions
{
IssuerUri = "https://idsrv3.com",
SiteName = "Thinktecture IdentityServer v3 - UserService-AspNetIdentity",
PublicHostName = "http://localhost:3333",
SigningCertificate = Certificate.Get(),
Factory = Factory.Configure(connString),
CorsPolicy = CorsPolicy.AllowAll
};
app.UseIdentityServer(options);
}
示例11: Configuration
public void Configuration(IAppBuilder app)
{
var users = new List<InMemoryUser>
{
new InMemoryUser
{
Subject = "E4A8B8DA-87F9-41CB-AA33-F79E621B3A56",
Username = "[email protected]",
Password = "password",
Claims = new List<Claim>
{
new Claim("email", "[email protected]"),
new Claim("role", "badmin")
}
}
};
var factory =
new IdentityServerServiceFactory()
.UseInMemoryUsers(users)
.UseInMemoryScopes(new List<Scope>())
.UseInMemoryClients(new List<Client>());
app.UseIdentityServer(new IdentityServerOptions
{
Factory = factory,
SigningCertificate = Cert.LoadSigning(),
PluginConfiguration = PluginConfiguration
});
}
示例12: Configuration
public void Configuration(IAppBuilder appBuilder)
{
//AntiForgeryConfig.UniqueClaimTypeIdentifier = Constants.ClaimTypes.Subject;
//JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.LiterateConsole(outputTemplate: "{Timestamp} [{Level}] ({Name}){NewLine} {Message}{NewLine}{Exception}")
.CreateLogger();
var factory = new IdentityServerServiceFactory()
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get());
// Register our custom user service
factory.UserService = new Registration<IUserService>(new CustomInMemoryUserService(Users.Get()));
var options = new IdentityServerOptions
{
SiteName = "Kroll Secure Token Service",
IssuerUri = "https://kroll-sts-local",
SigningCertificate = Certificate.Get(),
Factory = factory,
PluginConfiguration = ConfigurePlugins,
AuthenticationOptions = new IdentityServer3.Core.Configuration.AuthenticationOptions
{
EnablePostSignOutAutoRedirect = true,
IdentityProviders = ConfigureIdentityProviders,
EnableLocalLogin = false
}
};
appBuilder.UseIdentityServer(options);
}
示例13: Configuration
public void Configuration(IAppBuilder appBuilder)
{
var factory = new IdentityServerServiceFactory()
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get())
.UseInMemoryUsers(Users.Get());
factory.EventService = new Registration<IEventService, SeqEventService>();
var options = new IdentityServerOptions
{
SiteName = "IdentityServer3 (self host)",
SigningCertificate = Certificate.Get(),
Factory = factory,
EventsOptions = new EventsOptions
{
RaiseErrorEvents = true,
RaiseFailureEvents = true,
RaiseInformationEvents = true,
RaiseSuccessEvents = true
}
};
appBuilder.UseIdentityServer(options);
}
示例14: Configuration
public void Configuration(IAppBuilder appBuilder)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Trace()
.CreateLogger();
var factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get());
factory.ClaimsProvider = new Registration<IClaimsProvider, MyCustomClaimsProvider>();
factory.Register(new Registration<ICustomLogger, MyCustomDebugLogger>());
factory.CorsPolicyService = new Registration<ICorsPolicyService>(new DefaultCorsPolicyService { AllowAll = true });
var options = new IdentityServerOptions
{
SiteName = "IdentityServer3 - DependencyInjection",
SigningCertificate = Certificate.Get(),
Factory = factory,
};
appBuilder.UseIdentityServer(options);
}
示例15: Configuration
public void Configuration(IAppBuilder app)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Trace()
.CreateLogger();
app.UseIdentityServer();
}