本文整理汇总了C#中IdentityServer3.Core.Configuration.IdentityServerOptions类的典型用法代码示例。如果您正苦于以下问题:C# IdentityServerOptions类的具体用法?C# IdentityServerOptions怎么用?C# IdentityServerOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IdentityServerOptions类属于IdentityServer3.Core.Configuration命名空间,在下文中一共展示了IdentityServerOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configuration
public void Configuration(IAppBuilder app)
{
app.Map("/idmgr", adminApp =>
{
var factory = new IdentityManagerServiceFactory();
factory.ConfigureSimpleIdentityManagerService("DefaultConnection");
adminApp.UseIdentityManager(new IdentityManagerOptions()
{
Factory = factory
});
});
app.Map("/idsvr", core =>
{
var idSvrFactory = Factory.Configure();
idSvrFactory.ConfigureUserService("DefaultConnection");
var options = new IdentityServerOptions
{
SiteName = "IdentityServer3 - UserService-AspNetIdentity",
SigningCertificate = Certificate.Get(),
Factory = idSvrFactory,
AuthenticationOptions = new AuthenticationOptions
{
IdentityProviders = ConfigureAdditionalIdentityProviders,
}
};
core.UseIdentityServer(options);
});
}
示例2: Configuration
public void Configuration(IAppBuilder app)
{
// setup serilog to use diagnostics trace
Log.Logger = new LoggerConfiguration()
.WriteTo.Trace(outputTemplate: "{Timestamp} [{Level}] ({Name}){NewLine} {Message}{NewLine}{Exception}")
.CreateLogger();
app.Map("/core", coreApp =>
{
var factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get());
var options = new IdentityServerOptions
{
SiteName = "IdentityServer3 with WS-Federation",
SigningCertificate = Certificate.Get(),
Factory = factory,
PluginConfiguration = ConfigurePlugins,
};
coreApp.UseIdentityServer(options);
});
}
示例3: Configuration
public void Configuration(IAppBuilder app)
{
LogProvider.SetCurrentLogProvider(new DiagnosticsTraceLogProvider());
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Trace()
.CreateLogger();
app.UseAesDataProtectorProvider();
app.Map("/admin", adminApp =>
{
var factory = new IdentityManagerServiceFactory();
factory.ConfigureSimpleIdentityManagerService("AspId");
//factory.ConfigureCustomIdentityManagerServiceWithIntKeys("AspId_CustomPK");
var adminOptions = new IdentityManagerOptions(){
Factory = factory
};
adminOptions.SecurityConfiguration.RequireSsl = false;
adminApp.UseIdentityManager(adminOptions);
});
var idSvrFactory = Factory.Configure();
idSvrFactory.ConfigureUserService("AspId");
var viewOptions = new ViewServiceOptions
{
TemplatePath = this.basePath.TrimEnd(new char[] { '/' })
};
idSvrFactory.ViewService = new IdentityServer3.Core.Configuration.Registration<IViewService>(new ViewService(viewOptions));
var options = new IdentityServerOptions
{
SiteName = "IdentityServer3 - ViewSerive-AspNetIdentity",
SigningCertificate = Certificate.Get(),
Factory = idSvrFactory,
RequireSsl = false,
AuthenticationOptions = new AuthenticationOptions
{
IdentityProviders = ConfigureAdditionalIdentityProviders,
}
};
app.Map("/core", core =>
{
core.UseIdentityServer(options);
});
app.UseStaticFiles(new StaticFileOptions
{
RequestPath = new PathString("/Content"),
FileSystem = new PhysicalFileSystem(Path.Combine(this.basePath, "Content"))
});
var config = new HttpConfiguration();
// config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute("API", "api/{controller}/{action}", new { controller = "Home", action = "Get" });
app.UseWebApi(config);
}
示例4: Configuration
public void Configuration(IAppBuilder app)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Trace()
.CreateLogger();
app.Map("/core", coreApp =>
{
var factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get());
var viewOptions = new DefaultViewServiceOptions();
viewOptions.Stylesheets.Add("/Content/Site.css");
viewOptions.CacheViews = false;
factory.ConfigureDefaultViewService(viewOptions);
var options = new IdentityServerOptions
{
SiteName = "IdentityServer3 - Configuring DefaultViewService",
SigningCertificate = Certificate.Get(),
Factory = factory,
AuthenticationOptions = new AuthenticationOptions{
IdentityProviders = ConfigureAdditionalIdentityProviders,
}
};
coreApp.UseIdentityServer(options);
});
}
示例5: AccessTokenValidationController
public AccessTokenValidationController(TokenValidator validator, IdentityServerOptions options, ILocalizationService localizationService, IEventService events)
{
_validator = validator;
_options = options;
_localizationService = localizationService;
_events = events;
}
示例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)
{
Log.Logger = new LoggerConfiguration()
.WriteTo.Trace(outputTemplate: "{Timestamp} [{Level}] ({Name}){NewLine} {Message}{NewLine}{Exception}")
.CreateLogger();
var factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get());
// Use the Mvc View Service instead of the default
factory.ViewService = new Registration<IViewService, MvcViewService<LogonWorkflowController>>();
// These registrations are also needed since these are dealt with using non-standard construction
factory.Register(new Registration<HttpContext>(resolver => HttpContext.Current));
factory.Register(new Registration<HttpContextBase>(resolver => new HttpContextWrapper(resolver.Resolve<HttpContext>())));
factory.Register(new Registration<HttpRequestBase>(resolver => resolver.Resolve<HttpContextBase>().Request));
factory.Register(new Registration<HttpResponseBase>(resolver => resolver.Resolve<HttpContextBase>().Response));
factory.Register(new Registration<HttpServerUtilityBase>(resolver => resolver.Resolve<HttpContextBase>().Server));
factory.Register(new Registration<HttpSessionStateBase>(resolver => resolver.Resolve<HttpContextBase>().Session));
var options = new IdentityServerOptions
{
SigningCertificate = Certificate.Load(),
Factory = factory
};
appBuilder.Map("/core", idsrvApp =>
{
idsrvApp.UseIdentityServer(options);
});
}
示例8: Configuration
public void Configuration(IAppBuilder app)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Trace()
.CreateLogger();
Log.Debug("starting log. do not remove this line.");
LogProvider.GetLogger(typeof(Startup)).Log(LogLevel.Debug, () => "starting up");
app.Map("/core", core =>
{
var idSvrFactory = Factory.Configure();
idSvrFactory.ConfigureCustomUserService("Xyz");
var options = new IdentityServerOptions
{
SiteName = "Xyz University - Identity Server",
SigningCertificate = Certificate.Get(),
Factory = idSvrFactory,
AuthenticationOptions = new AuthenticationOptions
{
IdentityProviders = ConfigureAdditionalIdentityProviders,
}
};
core.UseIdentityServer(options);
});
}
示例9: Configuration
public void Configuration(IAppBuilder app)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Trace()
.CreateLogger();
app.Map("/core", coreApp =>
{
var factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get());
factory.ViewService = new Registration<IViewService>(typeof(CustomViewService));
//factory.UserService = new Registration<IUserService, UserService>();
factory.CorsPolicyService = new Registration<ICorsPolicyService>(new DefaultCorsPolicyService { AllowAll = true });
var options = new IdentityServerOptions
{
SiteName = "IdentityServer33 - CustomViewService",
SigningCertificate = Certificate.Get(),
Factory = factory,
AuthenticationOptions = new AuthenticationOptions {
IdentityProviders = ConfigureAdditionalIdentityProviders,
}
};
coreApp.UseIdentityServer(options);
});
}
示例10: GetRedirectUrl
public static string GetRedirectUrl(SignOutMessage message, IDictionary<string, object> env, IdentityServerOptions options)
{
var result = new LogoutResult(message, env, options);
var response = result.Execute();
return response.Headers.Location.AbsoluteUri;
}
示例11: 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);
}
示例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: InitializeIdServer
/// <summary>
/// Configura o mecanismo de identitdade, de acordo com o as configurações do idFactory.
/// </summary>
/// <param name="app"></param>
/// <param name="namerOrConnStr"></param>
/// <param name="idFactory"></param>
public void InitializeIdServer(IAppBuilder app, string namerOrConnStr, IdentityServerServiceFactory idFactory)
{
#region CONFIGURAÇÃO DO IDENTITY SERVER
app.Map("/identity", id => {
var options = new IdentityServerOptions {
SiteName = "GAC ERP Identity Server",
SigningCertificate = Certificado.Get(),
Factory = idFactory,
AuthenticationOptions = new AuthenticationOptions {
LoginPageLinks = new LoginPageLink[] {
new LoginPageLink{
Href = "/Account/ForgotPassword",
Text = "Esqueceu sua senha?"
}
},
EnableSignOutPrompt = false,
EnablePostSignOutAutoRedirect = true
},
};
id.UseIdentityServer(options);
});
#endregion
}
示例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)
{
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
app.Map("/identity", idsrvApp =>
{
var idServerServiceFactory = new IdentityServerServiceFactory()
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get())
.UseInMemoryUsers(Users.Get());
var options = new IdentityServerOptions
{
Factory = idServerServiceFactory,
SiteName = "TripCompany Security Token service",
IssuerUri = TripGallery.Constants.TripGalleryIssuerUri,
PublicOrigin = TripGallery.Constants.TripGallerySTSOrigin ,
SigningCertificate = LoadCertificate()
};
idsrvApp.UseIdentityServer(options);
}
);
}