{"id":20206987,"url":"https://github.com/oauth2-proxy/mockoidc","last_synced_at":"2026-04-07T04:31:34.113Z","repository":{"id":39762676,"uuid":"335084945","full_name":"oauth2-proxy/mockoidc","owner":"oauth2-proxy","description":"A Mock OIDC Server for Unit \u0026 Integration Tests","archived":false,"fork":false,"pushed_at":"2024-02-16T22:23:30.000Z","size":57,"stargazers_count":93,"open_issues_count":24,"forks_count":61,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-27T10:09:47.256Z","etag":null,"topics":["golang","oauth2","oidc"],"latest_commit_sha":null,"homepage":"","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/oauth2-proxy.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":"2021-02-01T21:10:07.000Z","updated_at":"2026-02-18T02:25:31.000Z","dependencies_parsed_at":"2024-11-14T05:27:07.837Z","dependency_job_id":"78806ea6-6500-4dca-b833-d6c939b9af41","html_url":"https://github.com/oauth2-proxy/mockoidc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oauth2-proxy/mockoidc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oauth2-proxy%2Fmockoidc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oauth2-proxy%2Fmockoidc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oauth2-proxy%2Fmockoidc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oauth2-proxy%2Fmockoidc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oauth2-proxy","download_url":"https://codeload.github.com/oauth2-proxy/mockoidc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oauth2-proxy%2Fmockoidc/sbom","scorecard":{"id":700747,"data":{"date":"2025-08-11","repo":{"name":"github.com/oauth2-proxy/mockoidc","commit":"caebfff84d250beabc710d98d58bc7efb9038411"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.4,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":3,"reason":"Found 6/16 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":2,"reason":"8 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2024-2631 / GHSA-c5q2-7r4c-mv6g","Warn: Project is vulnerable to: GO-2025-3485 / GHSA-c6gw-w398-hv78","Warn: Project is vulnerable to: GO-2025-3553 / GHSA-mh63-6h87-95cp","Warn: Project is vulnerable to: GO-2021-0356 / GHSA-8c26-wmh5-6g9v","Warn: Project is vulnerable to: GO-2024-2961","Warn: Project is vulnerable to: GO-2023-2402 / GHSA-45x7-px36-x8w8","Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T05:09:38.066Z","repository_id":39762676,"created_at":"2025-08-22T05:09:38.066Z","updated_at":"2025-08-22T05:09:38.066Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31500397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["golang","oauth2","oidc"],"created_at":"2024-11-14T05:27:03.622Z","updated_at":"2026-04-07T04:31:34.096Z","avatar_url":"https://github.com/oauth2-proxy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mockoidc\n\nA Mock OpenID Connect Server for Authentication Unit and Integration Tests.\n\nCreated by @NickMeves and @egrif during the [Greenhouse Software](https://medium.com/in-the-weeds)\n2021 Q1 Hack Day.\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/oauth2-proxy/mockoidc)](https://goreportcard.com/report/github.com/oauth2-proxy/mockoidc)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n[![Maintainability](https://api.codeclimate.com/v1/badges/99c0561090d1002dc7e3/maintainability)](https://codeclimate.com/github/oauth2-proxy/mockoidc/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/99c0561090d1002dc7e3/test_coverage)](https://codeclimate.com/github/oauth2-proxy/mockoidc/test_coverage)\n\n## Usage\n\nImport the package\n```\nimport \"github.com/oauth2-proxy/mockoidc\"\n```\n\nStart the MockOIDC Server. This will spin up a minimal OIDC server in its own\ngoroutine. It will listen on localhost on a random port.\n\nThen pull its configuration to integrate it with your application. Begin\ntesting!\n\n```\nm, _ := mockoidc.Run()\ndefer m.Shutdown()\n\ncfg := m.Config()\n// type Config struct {\n//   \tClientID     string\n//   \tClientSecret string\n//   \tIssuer       string\n//   \n//   \tAccessTTL  time.Duration\n//   \tRefreshTTL time.Duration\n// }\n```\n\n### RunTLS\n\nAlternatively, if you provide your own `tls.Config`, the server can run with\nTLS:\n\n```\ntlsConfig = \u0026tls.Config{\n    // ...your TLS settings\n}\n\nm, _ := mockoidc.RunTLS(tlsConfig)\ndefer m.Shutdown()\n```\n\n### Endpoints\n\nThe following endpoints are implemented. They can either be pulled from the\nOIDC discovery document (`m.Issuer() + \"/.well-known/openid-configuration`)\nor retrieved directly from the MockOIDC server.\n\n```\nm, _ := mockoidc.Run()\ndefer m.Shutdown()\n\nm.Issuer()\nm.DiscoveryEndpoint()\nm.AuthorizationEndpoint()\nm.TokenEndpoint()\nm.UserinfoEndpoint()\nm.JWKSEndpoint()\n```\n\n### Seeding Users and Codes\n\nBy default, calls to the `authorization_endpoint` will start a session as if\nthe `mockoidc.DefaultUser()` had logged in, and it will return a random code\nfor the `token_endpoint`. The User in the session started by this call to the\n`authorization_endpoint` will be the one in the tokens returned by the\nsubsequent `token_endpoint` call.\n\nThese can be seeded with your own test Users \u0026 codes that will be returned:\n\n```\nm, _ := mockoidc.Run()\ndefer m.Shutdown()\n\nuser := \u0026mockoidc.User{\n    // User details...\n}\n\n// Add the User to the queue, this will be returned by the next login\nm.QueueUser(user)\n\n// Preset the code returned by the next login\nm.QueueCode(\"12345\")\n\n// ...Request to m.AuthorizationEndpoint()\n```\n\n### Forcing Errors\n\nArbitrary errors can also be queued for handlers to return instead of their\ndefault behavior:\n\n```\nm, err := mockoidc.Run()\ndefer m.Shutdown()\n\nm.QueueError(\u0026mockoidc.ServerError{\n    Code: http.StatusInternalServerError,\n    Error: mockoidc.InternalServerError,\n    Description: \"Some Custom Description\",\n})\n```\n\n### Manipulating Time\n\nTo accurately test token expiration scenarios, the MockOIDC server's view of\ntime is completely mutable.\n\nYou can override the server's view of `time.Now`\n\n```\nmockoidc.NowFunc = func() { //...custom logic }\n```\n\nAs tests are running, you can fast-forward time to critical test points (e.g.\nAccess \u0026 Refresh Token expirations).\n\n```\nm, _ := mockoidc.Run()\n\nm.FastForward(time.Duration(1) * time.Hour)\n```\n\n#### Synchronizing with `jwt-go` time\n\nEven though we can fast-forward time, the underlying tokens processed by the\n[jwt-go](https://github.com/dgrijalva/jwt-go) library still have timing logic.\n\nWe need to synchronize our timer with theirs:\n\n```\nm, _ := mockoidc.Run()\ndefer m.Shutdown()\n\n// Overrides jwt.TimeFunc to m.Now\nreset := m.Synchronize()\n\n// reset is a mockoidc.ResetTime function that reverts jwt.TimeFunc to\n// its original state\ndefer reset()\n```\n\n### Manual Configuration\n\nEverything started up with `mockoidc.Run()` can be done manually giving the\nopportunity to finely tune the settings:\n\n```\n// Create a fresh RSA Private Key for token signing\nrsaKey, _ := rsa.GenerateKey(rand.Reader, 2048)\n\n// Create an unstarted MockOIDC server\nm, _ := mockoidc.NewServer(rsaKey)\n\n// Create the net.Listener on the exact IP:Port you want\nln, _ := net.Listen(\"tcp\", \"127.0.0.1:8080\")\n\ntlsConfig = \u0026tls.Config{\n    // ...your TLS settings\n}\n\n// tlsConfig can be nil if you want HTTP\nm.Start(ln, tlsConfig)\ndefer m.Shutdown()\n```\n\nNearly all the MockOIDC struct is public. If you want to update any settings\nto predefined values (e.g. `clientID`, `clientSecret`, `AccessTTL`,\n`RefreshTTL`) you can before calling `m.Start`.\n\nAdditional internal components of the MockOIDC server are public if you need\nto tamper with them as well:\n\n```\ntype MockOIDC struct {\n\t// ...other stuff\n\n\t// Normally, these would be private. Expose them publicly for\n\t// power users.\n\tServer       *http.Server\n\tKeypair      *Keypair\n\tSessionStore *SessionStore\n\tUserQueue    *UserQueue\n\tErrorQueue   *ErrorQueue\n}\n```\n\n#### Adding Middleware\n\nWhen configuring the MockOIDC server manually, you have the opportunity to add\ncustom middleware before starting the server (e.g. request logging, test\nvalidators, etc).\n\n```\nm, _ := mockoidc.NewServer(nil)\n\nmiddleware := func(next http.Handler) http.Handler {\n    return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {\n        // custom middleware logic here...\n        next.ServeHTTP(rw, req)\n        // custom middleware logic here...\n    })\n}\n\nm.AddMiddleware(middleware)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foauth2-proxy%2Fmockoidc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foauth2-proxy%2Fmockoidc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foauth2-proxy%2Fmockoidc/lists"}