vestibule_microsoft
Microsoft Identity Platform (v2.0) strategy.
vestibule_microsoft
Microsoft Identity Platform (v2.0) strategy.
Requests openid profile User.Read by default. Tokens are exchanged against
/oauth2/v2.0/token; user info comes from Microsoft Graph /me.
Tenant isolation
strategy() uses the /common authority, which accepts personal Microsoft
accounts and work/school accounts from any Microsoft Entra tenant that
can consent to the app. It does not restrict logins to one organization
and performs no tenant validation — use it only for explicitly multi-tenant
apps.
For single-organization apps use strategy_for_tenant(tenant_id). It targets
the tenant-specific authority endpoints and additionally verifies the tid
(tenant id) claim in the returned OpenID Connect ID token, failing
authentication when the token was issued by a different tenant.
Functions
build_authorization_code_request
Build a Microsoft authorization-code token request without sending it.
Use "common" for the multi-tenant endpoint or pass a tenant GUID to
match strategy_for_tenant.
pub fn build_authorization_code_request( String, config.ClientConfig, String, option.Option(String)) -> Result(request.Request(String), error.AuthError(a))build_jwks_request
Build Microsoft’s OpenID Connect JWKS request without sending it.
pub fn build_jwks_request() -> Result(request.Request(String), error.AuthError(a))build_refresh_token_request
Build a Microsoft refresh-token request without sending it.
Use the same authority value as the authorization-code request.
pub fn build_refresh_token_request( String, config.ClientConfig, String) -> Result(request.Request(String), error.AuthError(a))build_user_info_request
Build the Microsoft Graph /me request without sending it.
pub fn build_user_info_request(credential.Credentials) -> Result(request.Request(String), error.AuthError(a))parse_authorization_code_response
Parse Microsoft’s authorization-code HTTP response without performing I/O.
pub fn parse_authorization_code_response(response.Response(String)) -> Result(strategy.ExchangeResult, error.AuthError(a))parse_jwks_response
Parse Microsoft’s OpenID Connect JWKS response without performing I/O.
pub fn parse_jwks_response(response.Response(String)) -> Result(oidc.Jwks, error.AuthError(a))parse_refresh_token_response
Parse Microsoft’s refresh-token HTTP response without performing I/O.
pub fn parse_refresh_token_response(response.Response(String)) -> Result(credential.Credentials, error.AuthError(a))parse_token_response
Parse Microsoft token response JSON.
pub fn parse_token_response(String) -> Result(credential.Credentials, error.AuthError(a))parse_user_info_response
Parse a Microsoft Graph /me HTTP response without performing I/O.
pub fn parse_user_info_response(response.Response(String)) -> Result(#(String, user_info.UserInfo), error.AuthError(a))parse_user_response
Parse Microsoft Graph /me response JSON.
pub fn parse_user_response(String) -> Result(#(String, user_info.UserInfo), error.AuthError(a))strategy
Create a Microsoft authentication strategy using the /common authority.
Security warning: /common accepts personal Microsoft accounts and
work/school accounts from any Microsoft Entra tenant that can consent to the
app. It verifies the token’s tenant but allows any valid tenant. Use it only
for explicitly multi-tenant apps. For single-organization apps, use
strategy_for_tenant.
pub fn strategy() -> strategy.Strategy(a)strategy_for_tenant
Create a Microsoft authentication strategy locked to a single tenant.
tenant_id must be the tenant’s directory (tenant) GUID, e.g.
"72f988bf-86f1-41af-91ab-2d7cd011db47". The strategy uses the
tenant-specific authority endpoints
(https://login.microsoftonline.com/<tenant_id>/oauth2/v2.0/...) so
Microsoft itself only issues tokens for that tenant, and additionally
requests the openid scope and verifies that the tid claim in the
returned ID token equals tenant_id (case-insensitive). Authentication
fails if the ID token is missing or was issued by a different tenant.
Pass the tenant GUID rather than a verified domain (e.g.
contoso.onmicrosoft.com): the tid claim is always a GUID, so domain
values cannot be matched and would reject otherwise-valid logins.
pub fn strategy_for_tenant(String) -> strategy.Strategy(a)strategy_for_tenant_with_sender
Create a tenant-locked Microsoft strategy with a custom HTTP sender.
pub fn strategy_for_tenant_with_sender( String, fn(request.Request(String)) -> Result(response.Response(String), a)) -> strategy.Strategy(b)strategy_with_sender
Create a multi-tenant Microsoft strategy with a custom HTTP sender.
pub fn strategy_with_sender(fn(request.Request(String)) -> Result(response.Response(String), a)) -> strategy.Strategy(b)verify_id_token
Verify a Microsoft v2 ID token and return its stable object and tenant IDs.
Signature, RS256 algorithm, issuer, audience, time claims, tid, and oid
are required. For a tenant-locked strategy, tid must match the configured
tenant. Multi-tenant verification uses the untrusted tid only to select
the expected issuer, then requires the same value from the verified token.
pub fn verify_id_token( String, oidc.Jwks, String, option.Option(String)) -> Result(#(String, String), error.AuthError(a))