/// <summary> /// Prevents a default instance of the ApplicationEndpoint class from being created /// </summary> public ApplicationEndpoint(IClientPlatform platform, ApplicationEndpointSettings applicationEndpointSettings, IEventChannel eventChannel) { ClientPlatform = platform; m_endpointSettings = applicationEndpointSettings; if (eventChannel != null) { m_eventChannel = eventChannel; m_eventChannel.HandleIncomingEvents += this.OnReceivedCallback; } Logger.Instance.Information("Initializing ApplicationEndpoint"); var oauthTokenIdentitifier = new OAuthTokenIdentifier( Constants.PlatformAudienceUri, applicationEndpointSettings.ApplicationEndpointId.Domain); var tokenProvider = new AADServiceTokenProvider(platform.AADClientId.ToString(), Constants.AAD_AuthorityUri, platform.AADAppCertificate, platform.AADClientSecret); if (!platform.IsInternalPartner) { TokenMapper.RegisterNameSpaceHandling(Constants.DefaultResourceNamespace, Constants.PublicServiceResourceNamespace); } TokenMapper.RegisterTypesInAssembly(Assembly.GetAssembly(typeof(ApplicationsResource))); m_tokenProvider = tokenProvider; m_oauthTokenIdentifier = oauthTokenIdentitifier; m_restfulClient = ((ClientPlatform)ClientPlatform).RestfulClientFactory.GetRestfulClient(m_oauthTokenIdentifier, m_tokenProvider); Logger.Instance.Information("ApplicationEndpoint Initialized!"); }
public static void InitializeTokenMapper() { if (!TestHelper.IsInternalApp) { TokenMapper.RegisterNameSpaceHandling(Constants.DefaultResourceNamespace, Constants.PublicServiceResourceNamespace); } TokenMapper.RegisterTypesInAssembly(Assembly.GetAssembly(typeof(ApplicationsResource))); }