{"modulePath":"github.com/chainloop-dev/chainloop","version":"v1.138.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package token\n\n## Constants\n\n```go\nconst (\n\tUserAudience = \"user-auth.chainloop\"\n\tAPIAudience  = \"api-token-auth.chainloop\"\n)\n```\n\n## Functions\n\n```go\nfunc MismatchedOrganization(rawToken, organization string) string\n```\nMismatchedOrganization returns the API token's organization when it differs from the selected organization. A missing organization claim is allowed: instance-admin tokens intentionally use the organization header.\n\n## Types\n\n```go\ntype ParsedToken struct {\n\tID        string\n\tOrgID     string\n\tOrgName   string\n\tTokenType v1.Attestation_Auth_AuthType\n\t// Name of the API token (\"token_name\" claim). Only set for API tokens.\n\tName string\n\t// OIDC subject (\"sub\" claim). Only set for federated tokens.\n\tSubject string\n}\n```\n\n```go\nfunc Parse(token string) (*ParsedToken, error)\n```\nParse the token and return the type of token. At the moment in Chainloop we have 3 types of tokens: 1. User account token 2. API token 3. Federated token Each one of them have an associated audience claim that we use to identify the type of token. If the token is not present, nor we cannot match it with one of the expected audience, return nil.\n\n","path":"github.com/chainloop-dev/chainloop/app/cli/internal/token","name":"token","synopsis":"","isRedistributable":true}
