Base solution for your next web application

Activities of "ribbo"

You are correct, my test I accidentally actually used StaticRoleNames.Host.Admin which has a capital. So my test was wrong.

But that does still highlight the fact that SQLite is acting differently to EF with SQL Server in terms of Case Sensitivity?

Which log file is it going into? This doesn't happen to me but at times I would like it. I will ask the same question in reverse, how can I turn this on?

Thanks, Matt

Question

Hi, Since unit testing has switched to SQLite, it seems to be case sensitive VS non case sensitive with EntityFramework.

Eg. var adminUser = _context.Users.FirstOrDefault(u => u.TenantId == _tenantId && u.UserName == AbpUserBase.AdminUserName);

This returns the admin user when application runs normally but doesn't return when in test via SQLite. Changing it to lowercase "admin" works. var adminUser = _context.Users.FirstOrDefault(u => u.TenantId == _tenantId && u.UserName == "admin");

Is there a setting I can change to ensure consistency between SQLite and EF?

Thanks, Matt

Hi, I have actually got this all working. Steps was to copy the MVC project into my Angular solution from the MVC\JQuery solution. This gives me all the login requirements and Single Sign On token generation. Then added to the Angular Web.Core project to TokenAuthController a SingleSignOnAuthenticate function. This is then essentially the same as the Public website SSO login mixed with the Authenticate function. The key I found was to get the Identity which I used var identity = (ClaimsIdentity)(await _principalFactory.CreateAsync(user)).Identity; In the Angular side I just pass the SSOToken etc. into this function for SSO login.

It then worked perfectly to login from MVC login through to Angular application.

The reason I needed to do this is because the Angular application uses a very different Javascript based login for Social sites like Facebook, part of the reason you have issues with Microsoft login. I needed to sign into a different site Strava using OAuth2 that also can't be done easily via javascript. But it is easy to implement via the MVC project (I already had that working). So now I use the MVC project for Just logging into Strava via OAuth 2 and then SSO into the Angular project.

It works nicely now.

Thanks, Matt

I suggest you provide some more details of your issue\errors. This works fine for me with the 4.1.4 upgrade.

Thanks, Matt

In the login button on the public website you will see in the URL a parameter "returnURL". This tells tells the MVC application where to redirect the user to once the automatic sign in is done in the MVC application. You will see by default this returnURL is set to be the public website URL, meaning the user is logged in and redirected back to the public website. Change the returnURL to be what ever URL in your MVC application that you want the user to end up in.

eg. /account/login?ss=true&returnUrl=http://localhost:4200/App

Thanks, Matt

Hi, I have upgraded to 4.1.4 and see the Single Sign On method via a temporary token, but it is the other way round than I hoped. It still uses all the Angular Login and then passes back for Sign Sign On to the MVC site. Is it possible to do it the other way around and login via MVC and then pass Single Sign On Token across to the Angular project?

Thanks, Matt

Question

Hi, Running 4.1.4 Angular + Core and tried using Facebook login. After logging in with the popup when it returns and Angular calls ExternalAuthenticate I get an exception thrown.

It happens when LoginAsync is called function is called within ExternalAuthenticate

var loginResult = await _logInManager.LoginAsync(new UserLoginInfo(model.AuthProvider, model.ProviderKey, model.AuthProvider), GetTenancyNameOrNull());

The line before it

var externalUser = await GetExternalUserInfo(model);

seems to get an externalUser correctly, all is populated except EmailAddress (not sure if that has any impact).

The logs show

INFO  2017-07-07 17:29:09,423 [22   ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method LightboxLogic.StravaGO.Web.Controllers.TokenAuthController.ExternalAuthenticate (LightboxLogic.StravaGO.Web.Core) with arguments (LightboxLogic.StravaGO.Web.Models.TokenAuth.ExternalAuthenticateModel) - ModelState is Valid
ERROR 2017-07-07 17:29:19,079 [23   ] Mvc.ExceptionHandling.AbpExceptionFilter - Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Abp.Authorization.Users.AbpUser`1.SetNormalizedNames()
   at LightboxLogic.StravaGO.Authorization.Users.UserRegistrationManager.<RegisterAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at LightboxLogic.StravaGO.Web.Controllers.TokenAuthController.<RegisterExternalUserAsync>d__25.MoveNext()

Thanks, Matt

You are 100% right, I did not have Git installed on the machine and Bower was throwing an error due to this trying to restore. Once Git was installed Bower loaded all required components. I am sure its the same issue for the other person above.

Thanks!

This is from Web.Public in the Angular project

Showing 11 to 20 of 37 entries