Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Azure AD B2C endpoints #547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions endpoints/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@ func AzureAD(tenant string) oauth2.Endpoint {
}
}

// AzureADB2CEndpoint returns a new oauth2.Endpoint for the given tenant and policy at Azure Active Directory B2C.
// policy is the Azure B2C User flow name Example: `B2C_1_SignUpSignIn`.
// For more information see:
// https://docs.microsoft.com/en-us/azure/active-directory-b2c/tokens-overview#endpoints

func AzureADB2CEndpoint(tenant string, policy string) oauth2.Endpoint {
return oauth2.Endpoint{
AuthURL: "https://" + tenant + ".b2clogin.com/" + tenant + ".onmicrosoft.com/" + policy + "/oauth2/v2.0/authorize",
TokenURL: "https://" + tenant + ".b2clogin.com/" + tenant + ".onmicrosoft.com/" + policy + "/oauth2/v2.0/token",
}
}

// HipChatServer returns a new oauth2.Endpoint for a HipChat Server instance
// running on the given domain or host.
func HipChatServer(host string) oauth2.Endpoint {
Expand Down
13 changes: 13 additions & 0 deletions microsoft/microsoft.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,16 @@ func AzureADEndpoint(tenant string) oauth2.Endpoint {
TokenURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/token",
}
}

// AzureADB2CEndpoint returns a new oauth2.Endpoint for the given tenant and policy at Azure Active Directory B2C.
// policy is the Azure B2C User flow name Example: `B2C_1_SignUpSignIn`.
// For more information see:
// https://docs.microsoft.com/en-us/azure/active-directory-b2c/tokens-overview#endpoints

func AzureADB2CEndpoint(tenant string, policy string) oauth2.Endpoint {
return oauth2.Endpoint{
AuthURL: "https://" + tenant + ".b2clogin.com/" + tenant + ".onmicrosoft.com/" + policy + "/oauth2/v2.0/authorize",
TokenURL: "https://" + tenant + ".b2clogin.com/" + tenant + ".onmicrosoft.com/" + policy + "/oauth2/v2.0/token",
}
}