public static async Task <ActiveDirectoryServiceInfo> CreateAsync() { // For Active Directory, the resource ID and API Endpoint are static for the public O365 cloud. ActiveDirectoryServiceInfo info = new ActiveDirectoryServiceInfo { ResourceId = "https://graph.windows.net/", ApiEndpoint = "https://graph.windows.net" }; info.AccessToken = await Office365Helper.GetAccessToken(info.ResourceId); return(info); }
public virtual void Setup() { this.credentialCache = new MockAdalCredentialCache(); this.httpResponseMessage = new HttpResponseMessage(); this.serializer = new Serializer(); this.httpProvider = new MockHttpProvider(this.httpResponseMessage, this.serializer); this.serviceInfo = new ActiveDirectoryServiceInfo { AppId = "12345", AuthenticationServiceUrl = "https://login.live.com/authenticate", CredentialCache = this.credentialCache.Object, HttpProvider = this.httpProvider.Object, ReturnUrl = "https://login.live.com/return", SignOutUrl = "https://login.live.com/signout", TokenServiceUrl = "https://login.live.com/token" }; }
/////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////// FACTORY METHODS FOR RETRIEVING SERVICES /////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Returns information about the Active Directory service, including its access token. /// On error, this method will display an error message to the user, and return an /// Office365ServiceInfo instance whose HasValidAccessToken property is set to "false". /// </summary> public static async Task <Office365ServiceInfo> GetActiveDirectoryServiceInfoAsync() { return(await ActiveDirectoryServiceInfo.CreateAsync()); }