private static string BuildClientAccessUrl( AuthenticationGrantTypeClientCredential authenticationGrantTypeClientCredential, GetAuthenticationServicesAdto getAuthenticationServicesAdto) { IDictionaryBuilder <string, object> builder = DictionaryBuilder <string, object> .Create() .Add("clientId", authenticationGrantTypeClientCredential.ClientId); if (!string.IsNullOrWhiteSpace(getAuthenticationServicesAdto.State)) { builder.Add("state", getAuthenticationServicesAdto.State); } if (!string.IsNullOrWhiteSpace(getAuthenticationServicesAdto.RedirectUri)) { builder.Add("redirectUri", getAuthenticationServicesAdto.RedirectUri); } return(authenticationGrantTypeClientCredential.ClientGrantAccessTokenUrl.Format(builder.Build())); }
public async Task <IEnumerable <AuthenticationServiceAdto> > GetAuthenticationServicesAsync(GetAuthenticationServicesAdto getAuthenticationServicesAdto) { using (ITransaction transaction = _transactionManager.Create()) { IQueryable <AuthenticationService> authenticationServices = await _queryRepository.GetAsync(); IList <AuthenticationServiceAdto> authenticationServiceAdtos = new List <AuthenticationServiceAdto>(); foreach (AuthenticationService authenticationService in authenticationServices) { switch (authenticationService) { case AuthenticationGrantTypeClientCredential authenticationGrantTypeClientCredential: authenticationServiceAdtos.Add(_mapper.Map <AuthenticationGrantTypeClientCredential, ClientCredentialAuthenticationServiceAdto>(authenticationGrantTypeClientCredential, opts => opts.AfterMap((src, dest) => dest.AccessUrl = BuildClientAccessUrl(src, getAuthenticationServicesAdto)))); break; default: authenticationServiceAdtos.Add(_mapper.Map <AuthenticationService, AuthenticationServiceAdto>(authenticationService)); break; } } transaction.Commit(); return(authenticationServiceAdtos); } }
public Task <IEnumerable <AuthenticationServiceAdto> > GetAuthenticationServicesAsync(GetAuthenticationServicesAdto getAuthenticationServicesAdto) { return(_securityApplicationService.SecureAsync(() => _authenticationServiceApplicationService.GetAuthenticationServicesAsync(getAuthenticationServicesAdto), DefaultAuthorisationContext.Create(AuthorisationResource.AuthenticationService, AuthorisationAction.Search))); }