From 6a2004c8907a86949d71c664c81574897a4e55a6 Mon Sep 17 00:00:00 2001 From: Elena Grahovac Date: Wed, 6 Dec 2017 21:45:08 +0100 Subject: [PATCH] microsoft: add azure active directory endpoint Relevant Azure AD API documentation is here: https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols#endpoints Fixes #257 Change-Id: Ia4fb136bbaa9d4445cd098f354070f16ace3b24b Reviewed-on: https://go-review.googlesource.com/82315 Reviewed-by: Brad Fitzpatrick --- microsoft/microsoft.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/microsoft/microsoft.go b/microsoft/microsoft.go index f21b398..2fe8afc 100644 --- a/microsoft/microsoft.go +++ b/microsoft/microsoft.go @@ -14,3 +14,14 @@ var LiveConnectEndpoint = oauth2.Endpoint{ AuthURL: "https://login.live.com/oauth20_authorize.srf", TokenURL: "https://login.live.com/oauth20_token.srf", } + +// AzureActiveDirectoryEndpoint returns a new oauth2.Endpoint for the given tenant at Azure Active Directory. +// +// 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 { + return oauth2.Endpoint{ + AuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/authorize", + TokenURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/token", + } +}