Base solution for your next web application

Activities of "vladsd"

Thanks. One feature might be nice it to add ability to configure IS4 clients via tenant configuration, as it would change from one to another.

Same time IS4 supports mongodb, so one can just configure support? Right?

The issue is here with MailKit, here is Connect that fixes the issue client.Connect( _smtpEmailSenderConfiguration.Host, _smtpEmailSenderConfiguration.Port, //_smtpEmailSenderConfiguration.EnableSsl SecureSocketOptions.Auto );

I believe there is more, as backend needs to save into tenant storage. For example:

await SettingManager.ChangeSettingForTenantAsync(AbpSession.GetTenantId(),AppSettings.TenantManagement.BillingLegalName, input.LegalName);

vs

await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.DefaultFromAddress, input.DefaultFromAddress);

sounds like a great feature to have

I already did. There are a lot of good features in your framework that can be uncovered with a few lines of code.

It is created in my new project I call MyProject.Extensions

I tried adding this code in core module but it did not help: Configuration.IocManager.IocContainer.Register( Component.For<ITenantResolveContributor>() .ImplementedBy<DefaultTenantResolveContributor>() .LifestyleTransient()); }

Looks like a proper way to register is

Configuration.IocManager.Register<ITenantResolveContributor, DefaultTenantResolveContributor>(DependencyLifeStyle.Transient);

It worked.

Thanks, I just downloaded asp.net zero bundle 1 week ago, so I got an old version! Hmmmm.

Is there an easy way to bring the version or I have to import one fix at a time?

Update for all, the minute I add reference to the mongodb project for IdentityServer4 from <a class="postlink" href="https://github.com/diogodamiani/IdentityServer4.Contrib.MongoDB.git">https://github.com/diogodamiani/Identit ... ongoDB.git</a> it breaks ASP.NET Zero working with IdentityServer4

Sorry, no error messages, only in the log. Just the test fails. This one and see the log error

class Program
    {
        private const string ServerUrlBase = "http://localhost:22742/";//62114/";

        static void Main(string[] args)
        {
            RunDemoAsync().Wait();
            Console.ReadLine();
        }

        public static async Task RunDemoAsync()
        {
            var accessToken = await GetAccessTokenViaOwnerPasswordAsync();
            await GetUsersListAsync(accessToken);
        }

        private static async Task<string> GetAccessTokenViaOwnerPasswordAsync()
        {
            var disco = await DiscoveryClient.GetAsync(ServerUrlBase);

            using (var httpHandler = new HttpClientHandler())
            {
                httpHandler.CookieContainer.Add(new Uri(ServerUrlBase), new Cookie(MultiTenancyConsts.TenantIdResolveKey, "2")); //Set TenantId

                var tokenClient = new TokenClient(disco.TokenEndpoint, "client", "def2edf7-5d42-4edc-a84a-30136c340e13",
                    //"def2edf7-5d42-4edc-a84a-30136c340e13", 
                    httpHandler);

                //var tokenResponse = await tokenClient.RequestResourceOwnerPasswordAsync("alice", "alice");
                var tokenResponse = await tokenClient.RequestResourceOwnerPasswordAsync("admin", "Vlad1!");

                if (tokenResponse.IsError)
                {
                    Console.WriteLine("Error: ");
                    Console.WriteLine(tokenResponse.Error);
                }

                Console.WriteLine(tokenResponse.Json);

                return tokenResponse.AccessToken;
            }
        }

        private static async Task GetUsersListAsync(string accessToken)
        {
            using (var client = new HttpClient())
            {
                client.SetBearerToken(accessToken);

                var response = await client.GetAsync($"{ServerUrlBase}api/services/app/User/getUsers");
                if (!response.IsSuccessStatusCode)
                {
                    Console.WriteLine(response.StatusCode);
                    return;
                }

                var content = await response.Content.ReadAsStringAsync();
                var ajaxResponse = JsonConvert.DeserializeObject<AjaxResponse<PagedResultDto<UserListDto>>>(content);
                if (!ajaxResponse.Success)
                {
                    throw new Exception(ajaxResponse.Error?.Message ?? "Remote service throws exception!");
                }

                Console.WriteLine();
                Console.WriteLine("Total user count: " + ajaxResponse.Result.TotalCount);
                Console.WriteLine();

                foreach (var user in ajaxResponse.Result.Items)
                {
                    Console.WriteLine($"### UserId: {user.Id}, UserName: {user.UserName}");
                    Console.WriteLine(user.ToJsonString(indented: true));
                }
            }
        }
    }
}

INFO 2018-02-02 17:43:07,172 [12 ] Server4.Hosting.IdentityServerMiddleware - Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryEndpoint for /.well-known/openid-configuration INFO 2018-02-02 17:43:07,240 [12 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 181.0179ms 200 application/json; charset=UTF-8 INFO 2018-02-02 17:43:07,404 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://localhost:22742/.well-known/openid-configuration/jwks">http://localhost:22742/.well-known/open ... ation/jwks</a>
INFO 2018-02-02 17:43:07,413 [3 ] Server4.Hosting.IdentityServerMiddleware - Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryKeyEndpoint for /.well-known/openid-configuration/jwks INFO 2018-02-02 17:43:07,450 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 46.1597ms 200 application/json; charset=UTF-8 INFO 2018-02-02 17:43:10,299 [12 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 POST <a class="postlink" href="http://localhost:22742/connect/token">http://localhost:22742/connect/token</a> application/x-www-form-urlencoded 52 INFO 2018-02-02 17:43:10,323 [12 ] Server4.Hosting.IdentityServerMiddleware - Invoking IdentityServer endpoint: IdentityServer4.Endpoints.TokenEndpoint for /connect/token INFO 2018-02-02 17:43:10,522 [12 ] tIdentity.ResourceOwnerPasswordValidator - Credentials validated for username: admin INFO 2018-02-02 17:43:10,580 [12 ] Server4.Validation.TokenRequestValidator - Token request validation success { "ClientId": "client", "GrantType": "password", "Scopes": "default-api", "UserName": "admin", "Raw": { "grant_type": "password", "username": "admin", "password": "REDACTED" } } INFO 2018-02-02 17:43:10,898 [9 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 598.9385ms 200 application/json; charset=UTF-8 INFO 2018-02-02 17:43:11,830 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://localhost:22742/api/services/app/User/getUsers">http://localhost:22742/api/services/app/User/getUsers</a>
INFO 2018-02-02 17:43:11,888 [3 ] uthentication.JwtBearer.JwtBearerHandler - Failed to validate the token eyJhbGciOiJSUzI1NiIsImtpZCI6IjEyMWJmMzJhNmIwN2NkYzRjMTIxZmFiNDVlZGZmZjQ0IiwidHlwIjoiSldUIn0.eyJuYmYiOjE1MTc2MjIxOTAsImV4cCI6MTUxNzYyNTc5MCwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDoyMjc0MiIsImF1ZCI6WyJodHRwOi8vbG9jYWxob3N0OjIyNzQyL3Jlc291cmNlcyIsImRlZmF1bHQtYXBpIl0sImNsaWVudF9pZCI6ImNsaWVudCIsInN1YiI6IjYiLCJhdXRoX3RpbWUiOjE1MTc2MjIxOTAsImlkcCI6ImxvY2FsIiwiaHR0cDovL3d3dy5hc3BuZXRib2lsZXJwbGF0ZS5jb20vaWRlbnRpdHkvY2xhaW1zL3RlbmFudElkIjoiMyIsInNjb3BlIjpbImRlZmF1bHQtYXBpIl0sImFtciI6WyJwd2QiXX0.PQy9dDx-h6-uajt1233kJEXgY3TCKBXjUZJ4uJ7oK6cfkhOiImWzLwHVbheDNolumS3smyi-5ZjIW4jUSt2DY8wD9oYIvlOWbi3uuaT5392hxwtxGQ8NU_345hAXBhCemiWC7jAM7v_B1NBuuOmqvfp0X0H3z7YVYCUb9D-wzKa13ynkGLUGwVbywDviPXH1ZYcL5uGG-8uRvFt3MRdiZwgAyr9x4PoG2dFwlVZLXBRvG3R4Vw1zFbm7wnbdjXR-b2pj3rg_Ud762mfB37MO70V2DWns1s6cvuNfpLBv2t1LD2gKY7Makc9gHSxqvQ6PglB5OZjtoUgOHmzpbu78oQ. Microsoft.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException: IDX10501: Signature validation failed. Unable to match 'kid': '121bf32a6b07cdc4c121fab45edfff44', token: '{"alg":"RS256","typ":"JWT","kid":"121bf32a6b07cdc4c121fab45edfff44"}.{"nbf":1517622190,"exp":1517625790,"iss":"http://localhost:22742","aud":["http://localhost:22742/resources","default-api"],"client_id":"client","sub":"6","auth_time":1517622190,"idp":"local","http://www.aspnetboilerplate.com/identity/claims/tenantId":"3","scope":["default-api"],"amr":["pwd"]}'. at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters) at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken) at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.<HandleAuthenticateAsync>d__6.MoveNext() INFO 2018-02-02 17:43:11,890 [3 ] uthentication.JwtBearer.JwtBearerHandler - Bearer was not authenticated. Failure message: IDX10501: Signature validation failed. Unable to match 'kid': '121bf32a6b07cdc4c121fab45edfff44', token: '{"alg":"RS256","typ":"JWT","kid":"121bf32a6b07cdc4c121fab45edfff44"}.{"nbf":1517622190,"exp":1517625790,"iss":"http://localhost:22742","aud":["http://localhost:22742/resources","default-api"],"client_id":"client","sub":"6","auth_time":1517622190,"idp":"local","http://www.aspnetboilerplate.com/identity/claims/tenantId":"3","scope":["default-api"],"amr":["pwd"]}'. ERROR 2018-02-02 17:43:11,959 [3 ] nostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request System.MissingMethodException: Method not found: 'System.ValueTuple2<System.String,System.String> IdentityModel.Client.DiscoveryClient.ParseUrl(System.String)'. at IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationOptions.ConfigureJwtBearer(JwtBearerOptions jwtOptions) at Microsoft.Extensions.Options.OptionsFactory1.Create(String name) at Microsoft.Extensions.Options.OptionsMonitor1.<>c__DisplayClass10_0.<Get>b__0() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue() at Microsoft.Extensions.Options.OptionsCache1.GetOrAdd(String name, Func1 createOptions) at Microsoft.Extensions.Options.OptionsMonitor1.Get(String name) at Microsoft.AspNetCore.Authentication.AuthenticationHandler1.<InitializeAsync>d__42.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvider.<GetHandlerAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at IdentityServer4.Hosting.FederatedSignOut.FederatedSignoutAuthenticationHandlerProvider.<GetHandlerAsync>d__3.MoveNext() in C:\local\identity\server4\IdentityServer4\src\IdentityServer4\Hosting\FederatedSignOut\FederatedSignoutAuthenticationHandlerProvider.cs:line 33 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.AspNetCore.Authentication.AuthenticationService.<AuthenticateAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationHandler.<HandleAuthenticateAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.AspNetCore.Authentication.AuthenticationHandler1.<AuthenticateAsync>d__47.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.AspNetCore.Authentication.AuthenticationService.<AuthenticateAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.<Invoke>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.<Invoke>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext() INFO 2018-02-02 17:43:12,054 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 224.6711ms 500 text/html; charset=utf-8

To answer your questions: what errors are you getting? none, it would not transfer data Could you share error details (*/App_Data/Logs/logs.txt)? logs show no errors Did you add mapping configuration for these entity and DTO classess to *.Application.CustomDtoMapper.cs? There are already existing maps for features. They do not seems to work if you add new fields to classes.

//Feature
            configuration.CreateMap<FlatFeatureSelectDto, Feature>().ReverseMap();
            configuration.CreateMap<Feature, FlatFeatureDto>();
Showing 1 to 10 of 116 entries