{"id":19144419,"url":"https://github.com/maragudk/rest-auth-server","last_synced_at":"2025-08-13T11:49:01.536Z","repository":{"id":57694997,"uuid":"295718483","full_name":"maragudk/rest-auth-server","owner":"maragudk","description":"An example HTTP REST server with authentication and authorization.","archived":false,"fork":false,"pushed_at":"2023-02-25T03:23:33.000Z","size":12,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-10T04:57:56.208Z","etag":null,"topics":["auth","authentication","authorization","go","golang"],"latest_commit_sha":null,"homepage":"https://www.maragu.dk/blog/authentication-for-rest-apis-in-go/","language":"Go","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/maragudk.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":"2020-09-15T12:18:49.000Z","updated_at":"2025-06-10T13:30:10.000Z","dependencies_parsed_at":"2024-06-20T05:41:44.120Z","dependency_job_id":"6cae9263-8cfa-4929-a4ff-9dfaa02fa842","html_url":"https://github.com/maragudk/rest-auth-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maragudk/rest-auth-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maragudk%2Frest-auth-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maragudk%2Frest-auth-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maragudk%2Frest-auth-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maragudk%2Frest-auth-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maragudk","download_url":"https://codeload.github.com/maragudk/rest-auth-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maragudk%2Frest-auth-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270235104,"owners_count":24550175,"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","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"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":["auth","authentication","authorization","go","golang"],"created_at":"2024-11-09T07:34:54.913Z","updated_at":"2025-08-13T11:49:01.483Z","avatar_url":"https://github.com/maragudk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rest-auth-server\n\nAn example HTTP REST server with authentication and authorization.\n\nSee the blog post on [Authentication for REST APIs in Go](https://www.maragu.dk/blog/authentication-for-rest-apis-in-go/) for background.\n\n## Usage\n\nStart the server:\n\n```shell script\nmake start\n```\n\n### Demo\n\nTry out the endpoints with [HTTPie](https://httpie.org):\n\n```shell script\n$ make demo\nhttp -v --session=./session.json --verify=no https://localhost:8080/check\nGET /check HTTP/1.1\nAccept: */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nHost: localhost:8080\nUser-Agent: HTTPie/2.2.0\n\n\n\nHTTP/1.1 401 Unauthorized\nContent-Length: 27\nContent-Type: text/plain; charset=utf-8\nDate: Wed, 16 Sep 2020 08:18:18 GMT\nX-Content-Type-Options: nosniff\n\nunauthorized, please login\n\nhttp -v --session=./session.json --form --verify=no post https://localhost:8080/signup name=demo password=1234567890\nPOST /signup HTTP/1.1\nAccept: */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nContent-Length: 29\nContent-Type: application/x-www-form-urlencoded; charset=utf-8\nHost: localhost:8080\nUser-Agent: HTTPie/2.2.0\n\nname=demo\u0026password=1234567890\n\nHTTP/1.1 200 OK\nContent-Length: 0\nDate: Wed, 16 Sep 2020 08:18:18 GMT\n\n\n\nhttp -v --session=./session.json --form --verify=no post https://localhost:8080/login name=demo password=1234567890\nPOST /login HTTP/1.1\nAccept: */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nContent-Length: 29\nContent-Type: application/x-www-form-urlencoded; charset=utf-8\nHost: localhost:8080\nUser-Agent: HTTPie/2.2.0\n\nname=demo\u0026password=1234567890\n\nHTTP/1.1 200 OK\nCache-Control: no-cache=\"Set-Cookie\"\nContent-Length: 0\nDate: Wed, 16 Sep 2020 08:18:19 GMT\nSet-Cookie: session=IRygA46_XXlrTaqETg_eNhVoG6bfFKlWQdC9ATAsrPM; Path=/; Expires=Thu, 17 Sep 2020 08:18:20 GMT; Max-Age=86400; HttpOnly; Secure; SameSite=Lax\nVary: Cookie\n\n\n\nhttp -v --session=./session.json --verify=no https://localhost:8080/check\nGET /check HTTP/1.1\nAccept: */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nCookie: session=IRygA46_XXlrTaqETg_eNhVoG6bfFKlWQdC9ATAsrPM\nHost: localhost:8080\nUser-Agent: HTTPie/2.2.0\n\n\n\nHTTP/1.1 200 OK\nContent-Length: 31\nContent-Type: text/plain; charset=utf-8\nDate: Wed, 16 Sep 2020 08:18:19 GMT\n\n{\n    \"Name\": \"demo\",\n    \"Password\": null\n}\n\nhttp -v --session=./session.json --form --verify=no post https://localhost:8080/logout\nPOST /logout HTTP/1.1\nAccept: */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nContent-Length: 0\nContent-Type: application/x-www-form-urlencoded; charset=utf-8\nCookie: session=IRygA46_XXlrTaqETg_eNhVoG6bfFKlWQdC9ATAsrPM\nHost: localhost:8080\nUser-Agent: HTTPie/2.2.0\n\n\n\nHTTP/1.1 200 OK\nCache-Control: no-cache=\"Set-Cookie\"\nContent-Length: 0\nDate: Wed, 16 Sep 2020 08:18:20 GMT\nSet-Cookie: session=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT; Max-Age=0; HttpOnly; Secure; SameSite=Lax\nVary: Cookie\n\n\n\nhttp -v --session=./session.json --verify=no https://localhost:8080/check\nGET /check HTTP/1.1\nAccept: */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nHost: localhost:8080\nUser-Agent: HTTPie/2.2.0\n\n\n\nHTTP/1.1 401 Unauthorized\nContent-Length: 27\nContent-Type: text/plain; charset=utf-8\nDate: Wed, 16 Sep 2020 08:18:20 GMT\nX-Content-Type-Options: nosniff\n\nunauthorized, please login\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaragudk%2Frest-auth-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaragudk%2Frest-auth-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaragudk%2Frest-auth-server/lists"}