Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddApplicationInsightsTelemetry(Configuration);

            services.AddDbContext <ApplicationDbContext>(options =>
                                                         options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddIdentity <ApplicationUser, IdentityRole>()
            .AddEntityFrameworkStores <ApplicationDbContext>()
            .AddDefaultTokenProviders();

            services.AddMvc();

            services.AddCors();

            // Add application services.
            services.AddTransient <IEmailSender, AuthMessageSender>();
            services.AddTransient <ISmsSender, AuthMessageSender>();

            //setup Oidc
            OidcClientManager oidcClientMgr = new OidcClientManager();

            oidcClientMgr.AddClient(new OidcClient
            {
                ClientId          = "itemzWeb",
                DisplayName       = "itemz web app",
                RedirectUri       = "http://localhost:4200",
                LogoutRedirectUri = "http://localhost:4200",
                Secret            = "secret"
            });
            services.AddSingleton(oidcClientMgr);
        }
Ejemplo n.º 2
0
 public OidcController(OidcClientManager clientManager)
 {
     _clientManager = clientManager;
 }