microsoft: improve azure active directory endpoint

Rename AzureActiveDirectoryEndpoint to AzureADEndpoint. Add default tenant ("common").
Delete azure package (azure.Endpoint duplicates microsoft.AzureADEndpoint).

Change-Id: I48a7679ffddd984f5744a64edfa4df958c18ed66
Reviewed-on: https://go-review.googlesource.com/83696
Reviewed-by: JBD <jbd@google.com>
This commit is contained in:
Elena Grahovac
2017-12-13 15:17:04 +01:00
committed by JBD
parent 00dc70155e
commit 09bba2746c
2 changed files with 6 additions and 18 deletions

View File

@@ -15,11 +15,15 @@ var LiveConnectEndpoint = oauth2.Endpoint{
TokenURL: "https://login.live.com/oauth20_token.srf",
}
// AzureActiveDirectoryEndpoint returns a new oauth2.Endpoint for the given tenant at Azure Active Directory.
// AzureADEndpoint returns a new oauth2.Endpoint for the given tenant at Azure Active Directory.
// If tenant is empty, it uses the tenant called `common`.
//
// For more information see:
// https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols#endpoints
func AzureActiveDirectoryEndpoint(tenant string) oauth2.Endpoint {
func AzureADEndpoint(tenant string) oauth2.Endpoint {
if tenant == "" {
tenant = "common"
}
return oauth2.Endpoint{
AuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/authorize",
TokenURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/token",