{"id":19312087,"url":"https://github.com/authentiqid/example-aspnetcore-mvc","last_synced_at":"2026-06-17T19:31:41.502Z","repository":{"id":94335118,"uuid":"104075838","full_name":"AuthentiqID/example-aspnetcore-mvc","owner":"AuthentiqID","description":"Authentiq Sample for ASP.NET Core MVC","archived":false,"fork":false,"pushed_at":"2017-09-24T19:37:42.000Z","size":524,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-24T03:44:55.018Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AuthentiqID.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-19T13:05:04.000Z","updated_at":"2017-09-22T10:48:17.000Z","dependencies_parsed_at":"2023-03-23T03:47:34.520Z","dependency_job_id":null,"html_url":"https://github.com/AuthentiqID/example-aspnetcore-mvc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AuthentiqID/example-aspnetcore-mvc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AuthentiqID%2Fexample-aspnetcore-mvc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AuthentiqID%2Fexample-aspnetcore-mvc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AuthentiqID%2Fexample-aspnetcore-mvc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AuthentiqID%2Fexample-aspnetcore-mvc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AuthentiqID","download_url":"https://codeload.github.com/AuthentiqID/example-aspnetcore-mvc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AuthentiqID%2Fexample-aspnetcore-mvc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34463552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T00:32:40.295Z","updated_at":"2026-06-17T19:31:41.486Z","avatar_url":"https://github.com/AuthentiqID.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Authentiq Sample for ASP.NET Core MVC\n\nThis package is an example on how to add [Authentiq](https://www.authentiq.com/developers/?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=example-aspnetcore-mvc) authentication to you MVC App.\n\n\n## Requirements\n\n* .[NET Core 2.0 SDK](https://www.microsoft.com/net/download/core)\n\n\n## To run this project\n\n1. Run the application from the command line:\n\n```bash\n    dotnet run\n```\n\n2. Visit `http://localhost:5002` in your web browser to view this example website.\n\n\n## Register a new client with Authentiq\n\nThis example site uses a pre-configured test client at Authentiq in order you can run this example at `http://localhost:5002`, if you want to integrate Authentiq to your own site you will have to register your own application.\n\n1. First go to: [Authentiq Dashboard](https://dashboard.authentiq.com) and sign in.\n2. Create a new \"Hybrid\" application.\n3. Fill out any required fields such as the client name and provide your logo URL.\n4. Fill your URL in the \"Redirect URIs\": `https://YOUR_SITE.COM/signin-authentiq`\n5. Click on \"Show advanced options\" for the next two fields.\n6. Fill your URL in the \"Post logout Redirect URIs\": `https://YOUR_SITE.COM/signout-callback-authentiq`\n7. Fill your URL for the \"Backchannel logout URL\": `https://YOUR_SITE.COM/signout-authentiq`\n8. Click Save and note the application credentials (Client ID and Client Secret) as you will need this in the next section.\n\nNow that you have registered your application, enter the application credentials into the [appsettings.json](appsettings.json) file, under the Authentiq section.\n\n\n## Important parts of this example\n\n### 1. Register the Cookie and OIDC Authentication handlers\n\n```csharp\n// Startup.cs\n\npublic void ConfigureServices(IServiceCollection services)\n{\n  // Add authentication services\n  services.AddAuthentication(options =\u003e {\n    options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;\n    options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;\n    options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;\n  })\n  .AddCookie()\n  .AddOpenIdConnect(\"Authentiq\", options =\u003e {\n    // Set the authority to the Authentiq Provider\n    options.Authority = \"https://connect.authentiq.io\";\n\n    // Configure the Authentiq Client ID and Client Secret\n    options.ClientId = Configuration[\"Authentiq:ClientId\"];\n    options.ClientSecret = Configuration[\"Authentiq:ClientSecret\"];\n\n    // Set response type to: code id_token\n    options.ResponseType = \"code id_token\";\n\n    // Configure the Claims Issuer to be Authentiq\n    options.ClaimsIssuer = \"Authentiq\";\n\n    // Configure the scopes requested from user\n    // Check the supported [Identity Claims for Authentiq](http://developers.authentiq.io/#identity-claims)\n    options.Scope.Add(\"openid\");\n    options.Scope.Add(\"aq:push\");\n\n    // email shall be required and verified (signed)\n    options.Scope.Add(\"email~rs\");\n\n    // Request additional scopes which can be opted out by the user\n    //options.Scope.Add(\"phone\");\n    //options.Scope.Add(\"address\");\n    //options.Scope.Add(\"aq:location\");\n    //options.Scope.Add(\"profile\");\n\n    // Set the callback path, so that Authentiq will call back to http://localhost:5002/signin-authentiq \n    // check that you have added this full URL in the Authentiq dashboard at \"Redirect URIs\"\n    options.CallbackPath = new PathString(\"/signin-authentiq\");\n\n    options.SignedOutCallbackPath = new PathString(\"/signout-callback-authentiq\");\n    options.RemoteSignOutPath = new PathString(\"/signout-authentiq\");\n    \n    // The UserInfo endpoint does not return any additional claims next to the ones returned in the id_token\n    options.GetClaimsFromUserInfoEndpoint = false;\n\n    options.SaveTokens = true;\n  });\n\n  // Add framework services.\n  services.AddMvc();\n}\n```\n\n### 2. Register the Authentication middleware\n\n```csharp\npublic void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)\n{\n    JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();\n\n    loggerFactory.AddConsole(Configuration.GetSection(\"Logging\"));\n    loggerFactory.AddDebug();\n\n    if (env.IsDevelopment())\n    {\n      app.UseDeveloperExceptionPage();\n    }\n    else\n    {\n      app.UseExceptionHandler(\"/Home/Error\");\n    }\n\n  app.UseAuthentication();\n  app.UseStaticFiles();\n  app.UseMvcWithDefaultRoute();\n}\n```\n\n### 3. Log the user in\n\n```csharp\n// Controllers/HomeController.cs\n\npublic async Task Login()\n{\n  await HttpContext.ChallengeAsync(\"Authentiq\");\n}\n```\n\n### 4. Log the user out\n\nTo log the user out, we have to call the `SignOutAsync` method for both the Authentiq OIDC middleware as well as the Cookie middleware.\n\n```csharp\n// Controllers/HomeController.cs\n\npublic async Task Logout()\n{\n  await HttpContext.SignOutAsync(\"Authentiq\");\n  await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthentiqid%2Fexample-aspnetcore-mvc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauthentiqid%2Fexample-aspnetcore-mvc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthentiqid%2Fexample-aspnetcore-mvc/lists"}