|
| 1 | +// github_handler_constants.go |
| 2 | +package github |
| 3 | + |
| 4 | +// Endpoint constants represent the URL suffixes used for GitHub token interactions. |
| 5 | +const ( |
| 6 | + APIName = "github" // APIName: represents the name of the API. |
| 7 | + DefaultBaseDomain = "api.github.com" // DefaultBaseDomain: represents the base domain for the github instance. |
| 8 | + OAuthTokenEndpoint = "github.com/login/oauth/access_token" // OAuthTokenEndpoint: The endpoint to obtain an OAuth token. |
| 9 | + BearerTokenEndpoint = "" // BearerTokenEndpoint: The endpoint to obtain a bearer token. |
| 10 | + TokenRefreshEndpoint = "github.com/login/oauth/access_token" // TokenRefreshEndpoint: The endpoint to refresh an existing token. |
| 11 | + TokenInvalidateEndpoint = "api.github.com/applications/:client_id/token" // TokenInvalidateEndpoint: The endpoint to invalidate an active token. |
| 12 | + BearerTokenAuthenticationSupport = false // BearerTokenAuthSuppport: A boolean to indicate if the API supports bearer token authentication. |
| 13 | + OAuthAuthenticationSupport = true // OAuthAuthSuppport: A boolean to indicate if the API supports OAuth authentication. |
| 14 | + OAuthWithCertAuthenticationSupport = true // OAuthWithCertAuthSuppport: A boolean to indicate if the API supports OAuth with client certificate authentication. |
| 15 | +) |
| 16 | + |
| 17 | +// GetDefaultBaseDomain returns the default base domain used for constructing API URLs to the http client. |
| 18 | +func (g *GitHubAPIHandler) GetDefaultBaseDomain() string { |
| 19 | + return DefaultBaseDomain |
| 20 | +} |
| 21 | + |
| 22 | +// GetOAuthTokenEndpoint returns the endpoint for obtaining an OAuth token. Used for constructing API URLs for the http client. |
| 23 | +func (g *GitHubAPIHandler) GetOAuthTokenEndpoint() string { |
| 24 | + return OAuthTokenEndpoint |
| 25 | +} |
| 26 | + |
| 27 | +// GetBearerTokenEndpoint returns the endpoint for obtaining a bearer token. Used for constructing API URLs for the http client. |
| 28 | +func (g *GitHubAPIHandler) GetBearerTokenEndpoint() string { |
| 29 | + return BearerTokenEndpoint |
| 30 | +} |
| 31 | + |
| 32 | +// GetTokenRefreshEndpoint returns the endpoint for refreshing an existing token. Used for constructing API URLs for the http client. |
| 33 | +func (g *GitHubAPIHandler) GetTokenRefreshEndpoint() string { |
| 34 | + return TokenRefreshEndpoint |
| 35 | +} |
| 36 | + |
| 37 | +// GetTokenInvalidateEndpoint returns the endpoint for invalidating an active token. Used for constructing API URLs for the http client. |
| 38 | +func (g *GitHubAPIHandler) GetTokenInvalidateEndpoint() string { |
| 39 | + return TokenInvalidateEndpoint |
| 40 | +} |
| 41 | + |
| 42 | +// GetAPIBearerTokenAuthenticationSupportStatus returns a boolean indicating if bearer token authentication is supported in the api handler. |
| 43 | +func (g *GitHubAPIHandler) GetAPIBearerTokenAuthenticationSupportStatus() bool { |
| 44 | + return BearerTokenAuthenticationSupport |
| 45 | +} |
| 46 | + |
| 47 | +// GetAPIOAuthAuthenticationSupportStatus returns a boolean indicating if OAuth authentication is supported in the api handler. |
| 48 | +func (g *GitHubAPIHandler) GetAPIOAuthAuthenticationSupportStatus() bool { |
| 49 | + return OAuthAuthenticationSupport |
| 50 | +} |
| 51 | + |
| 52 | +// GetAPIOAuthWithCertAuthenticationSupportStatus returns a boolean indicating if OAuth with client certificate authentication is supported in the api handler. |
| 53 | +func (g *GitHubAPIHandler) GetAPIOAuthWithCertAuthenticationSupportStatus() bool { |
| 54 | + return OAuthWithCertAuthenticationSupport |
| 55 | +} |
0 commit comments