{"id":18339476,"url":"https://github.com/antelcat/server","last_synced_at":"2025-08-26T03:30:47.061Z","repository":{"id":167316666,"uuid":"642927254","full_name":"Antelcat/Server","owner":"Antelcat","description":"Server side of foundation","archived":false,"fork":false,"pushed_at":"2024-12-03T18:13:20.000Z","size":903,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-12-03T19:24:15.500Z","etag":null,"topics":["authentication","autowired","dependency-injection","jwt","logging","webapi"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Antelcat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-05-19T17:04:49.000Z","updated_at":"2024-12-03T18:13:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4934094-0a3b-43a3-8f3e-7c7e96406a99","html_url":"https://github.com/Antelcat/Server","commit_stats":null,"previous_names":["antelcat/foundation-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Antelcat","download_url":"https://codeload.github.com/Antelcat/Server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230985916,"owners_count":18310922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["authentication","autowired","dependency-injection","jwt","logging","webapi"],"created_at":"2024-11-05T20:17:59.824Z","updated_at":"2024-12-23T16:21:42.206Z","avatar_url":"https://github.com/Antelcat.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Antelcat.Foundation.Server\n\nServer side of code foundation\n\nReference to :\n\n+ [Antelcat.Foundation.Core](https://github.com/Antelcat/Foundation-Core)\n+ [Feast.RequestMapper](https://github.com/feast107/RequestMapper)\n\n## Dependency-Injection\n\n\n## Authentication  \n\n+ Jwt\n\n    Easily configure jwt authentication by serialize model into claims and back :\n\n    ``` c#\n    builder.Services.ConfigureJwt\u003cIdentityModel\u003e(\n        configure: static jwt =\u003e jwt.Secret = \"Your secret key\",\n        validation: static async (identity,context) =\u003e {\n            if (identity.Id \u003c 0) context.Fail(\"Jwt token invalid\"); \n        },\n        denied: static context =\u003e \"Your role has no permission\",\n        failed: static context =\u003e \"You are an unauthorized audience\"\n    );\n    ```\n\n    when inherit from [BaseController](/src/Antelcat.Server/Controllers/BaseController.cs), controllers can resolve identity like :\n\n    ``` c#\n    [ApiController]\n    public class IdentityController : BaseController\u003cIdentityController\u003e{\n        \n        [Autowired]\n        private JwtConfigure\u003cIdentityModel\u003e configure;\n\n        [HttpPost]\n        [AllowAnonymous]\n        public IActionResult MyToken([FromBody]IdentityModel identity){\n            return configure.CreateToken(identity);\n        }\n\n        [HttpGet]\n        [Authorize]\n        public IActionResult WhoAmI(){\n            return base.Identity\u003cIdentityModel\u003e();\n        }\n    }\n    ```\n\n+ Cookie\n\n    Cookie authentication seems to be less related to identity model but you still need to provide it :\n\n    ``` c#\n    builder.Services.ConfigureCookie\u003cIdentityModel\u003e(\n        denied: static context =\u003e \"Your role has no permission\",\n        failed: static context =\u003e \"You are an unauthorized audience\"\n    );\n    ```\n\n\n    ``` c#\n    [ApiController]\n    public class IdentityController : BaseController\u003cIdentityController\u003e{\n\n        [HttpPost]\n        [AllowAnonymous]\n        public async Task\u003cIActionResult\u003e SignInAsync([FromBody]IdentityModel identity){\n            base.SignInAsync(identity, \"User\");\n            return \"Successfully login\";\n        }\n\n        [HttpGet]\n        [Authorize]\n        public async Task\u003cIActionResult\u003e SignOutAsync(){\n            await SignOutAsync();\n            return \"Successfully logout\";\n        }\n\n        [HttpGet]\n        [Authorize]\n        public IActionResult WhoAmI(){\n            return base.Identity\u003cIdentityModel\u003e();\n        }\n    }\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantelcat%2Fserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantelcat%2Fserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantelcat%2Fserver/lists"}