{"id":22620302,"url":"https://github.com/qba73/scope","last_synced_at":"2025-03-29T02:13:01.235Z","repository":{"id":162239739,"uuid":"636830428","full_name":"qba73/scope","owner":"qba73","description":"Scope validates if OIDC tokens conform to RFC6749 spec","archived":false,"fork":false,"pushed_at":"2024-04-01T17:47:37.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T12:16:39.823Z","etag":null,"topics":["go","go-package","golang","oidc","oidc-token"],"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/qba73.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}},"created_at":"2023-05-05T18:42:41.000Z","updated_at":"2023-05-06T06:54:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"9ea8a747-b2b6-40f5-9716-61b9c80d8f5b","html_url":"https://github.com/qba73/scope","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qba73%2Fscope","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qba73%2Fscope/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qba73%2Fscope/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qba73%2Fscope/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qba73","download_url":"https://codeload.github.com/qba73/scope/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246126720,"owners_count":20727594,"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":["go","go-package","golang","oidc","oidc-token"],"created_at":"2024-12-08T22:13:07.541Z","updated_at":"2025-03-29T02:13:01.216Z","avatar_url":"https://github.com/qba73.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Reference](https://pkg.go.dev/badge/github.com/qba73/scope.svg)](https://pkg.go.dev/github.com/qba73/scope)\n[![Go](https://github.com/qba73/scope/actions/workflows/go.yml/badge.svg)](https://github.com/qba73/scope/actions/workflows/go.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/qba73/scope)](https://goreportcard.com/report/github.com/qba73/scope)\n\n# scope\n\n`scope` is a Go library for validating [OIDC token scopes](https://auth0.com/docs/get-started/apis/scopes/openid-connect-scopes). It allows you to verify if tokens meet validation requirements described in the [RFC6749](https://datatracker.ietf.org/doc/html/rfc6749#section-3.3) document.\n\n## Using the Go library\n\nThe following example illustrates how to verify the OIDC scope string. The scope must include the `openid` token.\n\n```go\nimport (\n    \"fmt\"\n    \"strings\"\n\n    \"github.com/qba73/scope\"\n)\n\nfunc main() {\n    scopes := []string{\"openid myscope email\", \"myscope email\"}\n    \n    for _, s := range scopes {\n        if !scope.ValidOIDC(s) {\n            fmt.Println(\"invalid scope\")\n        }\n    }\n}\n```\n\nThe following example illustrates how to verify tokens in the scope. Note that func `Valid()` validates\nif tokens do not contain [unsupported characters](https://datatracker.ietf.org/doc/html/rfc6749#section-3.3).\n\n```go\nimport (\n    \"fmt\"\n    \"strings\"\n\n    \"github.com/qba73/scope\"\n)\n\nfunc main() {\n    tokens := \"openid myscope email\"\n    \n    for _, token := range strings.Split(tokens, \"+\") {\n        if !scope.Valid(token) {\n            fmt.Printf(\"scope/token %v is not valid\\n\", token)\n        }\n        fmt.Printf(\"scope/token %v is valid\\n\", token)\n    }\n}\n```\n\n## Bugs and feature requests\n\nIf you find a bug in the `scope` library, please open an issue. Similarly, if you'd like a feature added or improved, let me know via an issue.\n\nPull requests welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqba73%2Fscope","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqba73%2Fscope","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqba73%2Fscope/lists"}