Documentation
¶
Overview ¶
Package oauthmicrosoft provides a Microsoft OAuth provider for the Limen OAuth plugin.
Index ¶
- func New(opts ...ConfigOption) oauth.Provider
- type ConfigOption
- func WithAuthorityURL(url string) ConfigOption
- func WithClientID(id string) ConfigOption
- func WithClientSecret(secret string) ConfigOption
- func WithIDTokenVerifier(verifier oauth.IDTokenVerifier) ConfigOption
- func WithOption(key, value string) ConfigOption
- func WithRedirectURL(url string) ConfigOption
- func WithScopes(scopes ...string) ConfigOption
- func WithTenant(tenant string) ConfigOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...ConfigOption) oauth.Provider
New creates a Microsoft OAuth provider that implements oauth.Provider.
Types ¶
type ConfigOption ¶
type ConfigOption func(*config)
ConfigOption configures the Microsoft OAuth plugin.
func WithAuthorityURL ¶
func WithAuthorityURL(url string) ConfigOption
WithAuthorityURL sets a custom authority base URL for the authorization and token endpoints. Use this for Microsoft Entra External ID (CIAM) or other non-standard deployments.
Example CIAM: "https://mytenant.ciamlogin.com/mytenant.onmicrosoft.com" Example standard: "https://login.microsoftonline.com/contoso.onmicrosoft.com"
When set, this takes precedence over WithTenant.
func WithClientID ¶
func WithClientID(id string) ConfigOption
WithClientID sets the Microsoft OAuth2 client ID (Application ID). Defaults to env var MICROSOFT_CLIENT_ID.
func WithClientSecret ¶
func WithClientSecret(secret string) ConfigOption
WithClientSecret sets the Microsoft OAuth2 client secret. Defaults to env var MICROSOFT_CLIENT_SECRET.
func WithIDTokenVerifier ¶
func WithIDTokenVerifier(verifier oauth.IDTokenVerifier) ConfigOption
func WithOption ¶
func WithOption(key, value string) ConfigOption
WithOption sets any additional OAuth2 authorization parameters.
func WithRedirectURL ¶
func WithRedirectURL(url string) ConfigOption
WithRedirectURL sets the callback URL registered in the Azure Portal.
func WithScopes ¶
func WithScopes(scopes ...string) ConfigOption
WithScopes sets the OAuth2 scopes (e.g. "openid", "profile", "email").
func WithTenant ¶
func WithTenant(tenant string) ConfigOption
WithTenant sets the Azure AD tenant for the authorization and token endpoints. Common values: "common" (default, all account types), "organizations" (work/school only), "consumers" (personal Microsoft accounts only), or a specific tenant GUID/domain.