{"id":21180868,"url":"https://github.com/mariomenjr/identity","last_synced_at":"2026-05-04T01:34:04.531Z","repository":{"id":48941274,"uuid":"363815053","full_name":"mariomenjr/identity","owner":"mariomenjr","description":"Identity Server 4 implementation using MongoDB for Stores.","archived":false,"fork":false,"pushed_at":"2022-04-17T22:40:19.000Z","size":82,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-13T03:41:51.684Z","etag":null,"topics":["csharp","docker","docker-compose","elsalvador","identity","identityserver4","jwt-authentication","mongo","mongodb","netcore","oauth2","server"],"latest_commit_sha":null,"homepage":"https://github.com/mariomenjr/identity","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/mariomenjr.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}},"created_at":"2021-05-03T04:23:45.000Z","updated_at":"2023-09-25T16:51:29.000Z","dependencies_parsed_at":"2022-08-26T02:51:09.538Z","dependency_job_id":null,"html_url":"https://github.com/mariomenjr/identity","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mariomenjr/identity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariomenjr%2Fidentity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariomenjr%2Fidentity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariomenjr%2Fidentity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariomenjr%2Fidentity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mariomenjr","download_url":"https://codeload.github.com/mariomenjr/identity/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariomenjr%2Fidentity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32591601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"ssl_error","status_checked_at":"2026-05-03T22:09:10.534Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["csharp","docker","docker-compose","elsalvador","identity","identityserver4","jwt-authentication","mongo","mongodb","netcore","oauth2","server"],"created_at":"2024-11-20T17:46:18.598Z","updated_at":"2026-05-04T01:34:04.515Z","avatar_url":"https://github.com/mariomenjr.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Identity\n\nIdentity Server 4 using MongoDB for Stores.\n\nLive @ [identity.mariomenjr.com](https://identity.mariomenjr.com/)\n\n## 1. Identity \n\n### 1.1. Run\n\nProvide your `MongoSettings`. See [3.2. appsettings.json](#32-appsettingsjson).\n\n#### 1.1.1. Linux\n\nYou can run this project on Linux through the JetBrains Rider IDE.\n\nAdditionally, you can use Docker:\n\n```bash\nsh ./setup.sh development\n```\n\n#### 1.1.2. Windows \u0026 Mac\n\nThrough Visual Studio or JetBrains Rider IDEs.\n\n### 1.2. Deploy\n\n#### 1.2.1. Linux \u0026 Mac (Using Docker)\n\n```bash\nsh ./setup.sh production\n```\n\n#### 1.2.2. Windows\n\nThrough Visual Studio IDE.\n\n## 2. Samples\n\nBy Grant types.\n\n### 2.1. client_credentials\n\n#### 2.1.1. Request\n\nBy some implementations.\n\n##### 2.1.1.1. HTTP\n\n```http\nPOST /connect/token HTTP/1.1\nHost: identity.mariomenjr.com:443\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 94\n\nclient_id=test.client\u0026client_secret=test.secret\u0026scope=test.scope\u0026grant_type=client_credentials\n```\n\n##### 2.1.1.2. cURL\n\n```bash\ncurl --location --request POST 'https://identity.mariomenjr.com:443/connect/token' \\\n--header 'Content-Type: application/x-www-form-urlencoded' \\\n--data-urlencode 'client_id=test.client' \\\n--data-urlencode 'client_secret=test.secret' \\\n--data-urlencode 'scope=test.scope' \\\n--data-urlencode 'grant_type=client_credentials'\n```\n\n##### 2.1.1.3. JavaScript - Fetch\n\n```javascript\nvar myHeaders = new Headers();\nmyHeaders.append(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\nvar urlencoded = new URLSearchParams();\nurlencoded.append(\"client_id\", \"test.client\");\nurlencoded.append(\"client_secret\", \"test.secret\");\nurlencoded.append(\"scope\", \"test.scope\");\nurlencoded.append(\"grant_type\", \"client_credentials\");\n\nvar requestOptions = {\n  method: \"POST\",\n  headers: myHeaders,\n  body: urlencoded,\n  redirect: \"follow\",\n};\n\nfetch(\"https://identity.mariomenjr.com:443/connect/token\", requestOptions)\n  .then((response) =\u003e response.text())\n  .then((result) =\u003e console.log(result))\n  .catch((error) =\u003e console.log(\"error\", error));\n```\n\n#### 2.1.2. Response\n\n```json\n{\n  \"access_token\": \"eyJhbGciOiJSUzI1NiIsImtpZCI6IjA5RjE4MUUzMzNCMzVBMTM0RTQ3MjE1ODZENjgyRjUwIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2MjQxNjExNDMsImV4cCI6MTYyNDE2NDc0MywiaXNzIjoiaHR0cDovL2lkZW50aXR5Lm1hcmlvbWVuanIuY29tIiwiY2xpZW50X2lkIjoidGVzdC5jbGllbnQiLCJqdGkiOiIyNTc5MEM0QUZGNzQ3NTZDNzM5RjQ4RjEzRkUyMDc2RSIsImlhdCI6MTYyNDE2MTE0Mywic2NvcGUiOlsidGVzdC5zY29wZSJdfQ.sm91IYPIn2O5c1BukDrhJPYMqmFl48f5CBaDdpUCrCdWt9oUKCF_w4etyfEbb7wfb94zzbxOQvdLCVQKshh7abFaA5AGgi9jBDkrpEBIxwlnNcjNAo6GG_W1h9lZ9BdxW3kXSUEvL8h1JQMbWRiaQmJcrJCH0m-Nv2NiRDSJ0rJyes73Aa2IVHJRwQ4WvwdNxRLE5Zg03w9X70_KARN7rdppkZiyEZCoCpR-58DVxlhs6uJuetFIE-sUCpb52xTM3u5-0uZm3VgsP41boc0BfAuSt71RnDhf9-flCoRezAXcBSCXymiaxiUTRETAQsDXSKAwWG33Zb3_m9joEHijVg\",\n  \"expires_in\": 3600,\n  \"token_type\": \"Bearer\",\n  \"scope\": \"test.scope\"\n}\n```\n\n## 3. Stores\n\nThis implementation uses MongoDB to store Client \u0026 Resource data. As of now, the database has to be manually created.\n\n### 3.1. Collection schemas\n\nFeel free to use schemas below.\n\n```json\n// Collection name: Clients\n{\n  \"_id\": { \"$oid\": \"60bc183aa50e552edc2e4ca6\" },\n  \"name\": \"test.client\",\n  \"secret\": \"test.secret\",\n  \"apiScopeIds\": [{ \"$oid\": \"60ceb1e8a50e552edc2bc40a\" }]\n}\n```\n\n```json\n// Collection name: ApiScopes\n{\n  \"_id\": { \"$oid\": \"60ceb1e8a50e552edc2bc40a\" },\n  \"name\": \"test.scope\",\n  \"displayName\": \"Test Scope\"\n}\n```\n\n```json\n// Collection name: ApiResources\n{\n  \"_id\": { \"$oid\": \"60bc327fa50e552edc3296b7\" },\n  \"name\": \"continuee_api\",\n  \"apiScopeIds\": [\n    { \"$oid\": \"60bc4fb5a50e552edc374527\" },\n    { \"$oid\": \"60bc5ae9a50e552edc3a32fd\" }\n  ]\n}\n```\n\n```json\n// Collection name: IdentityResources\n\n// Pending implementation\n```\n\n### 3.2. appsettings.json\n\nYou need to provide the credentials to connect to your MongoDB database.\n\nCurrently, the appsettings.json is being tracked by Git. Be careful when making changes to this file, you don't want your credentials to get into a public repository.\n\n```json5\n// appsettings.json\n{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"Information\",\n      \"Microsoft\": \"Warning\",\n      \"Microsoft.Hosting.Lifetime\": \"Information\"\n    }\n  },\n  \"AllowedHosts\": \"*\",\n  \"MongoSettings\": {\n    // Replace values with your own, without \u003c\u003e\n    \"ConnectionString\": \"mongodb+srv://\u003cusername\u003e:\u003cpassword\u003e@\u003cserver\u003e/\u003cdatabase\u003e?retryWrites=true\u0026w=majority\",\n\n    // Replace values with your own, without \u003c\u003e\n    \"DatabaseName\": \"\u003cdatabase\u003e\"\n  }\n}\n```\n\n## 4. To do\n\n- Externalize IdentityResources\n- Implement secrets.json with Docker for MongoSettings (Ref: https://blog.matjanowski.pl/2017/11/18/managing-options-and-secrets-in-net-core-and-docker/)\n- Create permanent signing credential for Identity Server. Stop using `builder.AddDeveloperSigningCredential()`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmariomenjr%2Fidentity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmariomenjr%2Fidentity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmariomenjr%2Fidentity/lists"}