{"id":23721067,"url":"https://github.com/nhas/session","last_synced_at":"2026-02-15T03:32:21.826Z","repository":{"id":190912576,"uuid":"683578823","full_name":"NHAS/session","owner":"NHAS","description":"A simple HTTP session manager","archived":false,"fork":false,"pushed_at":"2024-12-10T09:22:46.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-30T14:14:36.520Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/NHAS.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":"2023-08-27T03:03:53.000Z","updated_at":"2024-12-10T09:22:50.000Z","dependencies_parsed_at":"2023-08-27T04:22:04.877Z","dependency_job_id":"3369c678-943a-418b-8512-456bdeadc4dd","html_url":"https://github.com/NHAS/session","commit_stats":null,"previous_names":["nhas/session"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NHAS/session","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHAS%2Fsession","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHAS%2Fsession/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHAS%2Fsession/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHAS%2Fsession/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NHAS","download_url":"https://codeload.github.com/NHAS/session/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHAS%2Fsession/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29466929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T01:01:38.065Z","status":"online","status_checked_at":"2026-02-15T02:00:07.449Z","response_time":118,"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-12-30T22:16:53.284Z","updated_at":"2026-02-15T03:32:21.810Z","avatar_url":"https://github.com/NHAS.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# session\nA simple HTTP session manager. Got bored and needed to have a session manager that manages idle timeouts as well as longer max timeouts. \n\n\n\nExample:\n```go\n\n\ntype SessionEntry struct {\n\tArbitraryContent string\n}\n\n\nsessionManager = NewStore[SessionEntry](\"session\", time.Duration(IdleTimeDuration)*time.Second)\n\nauthorisedRoutes := http.NewServeMux()\nauthorisedRoutes.HandleFunc(\"/status\", status)\nauthorisedRoutes.HandleFunc(\"/dashboard/\", dashboard)\n\n\nlog.Fatal(http.ListenAndServe(addr, sessionManager.AuthorisationChecks(authorisedRoutes, nil)))\n\n\n```\n\n```go\n_, data := sessionManager.GetSessionFromRequest(r)\nif data == nil {\n    http.Error(w, \"No\", http.StatusUnauthorized)\n    return\n}\n```\n\n```go\nsessionKey := sessionManager.StartSession(w, r, currentSession, func(session SessionEntry) {\n // Do something on session expiry\t\n})\n\n// Do stuff\n\n\nsessionManager.DeleteSession(w,r)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhas%2Fsession","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhas%2Fsession","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhas%2Fsession/lists"}