Skip to content

Commit

Permalink
Fixes #11591
Browse files Browse the repository at this point in the history
  • Loading branch information
rickbutterfield authored and bergmania committed Nov 15, 2021
1 parent 25e82dd commit cb15c2a
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/Umbraco.Web.BackOffice/Security/BackOfficeSignInManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ private async Task<SignInResult> AutoLinkAndSignInExternalAccount(ExternalLoginI
return AutoLinkSignInResult.FailedException(ex.Message);
}

var shouldSignIn = autoLinkOptions.OnExternalLogin(autoLinkUser, loginInfo);
if (shouldSignIn == false)
{
Logger.LogWarning("The AutoLinkOptions of the external authentication provider '{LoginProvider}' have refused the login based on the OnExternalLogin method. Affected user id: '{UserId}'", loginInfo.LoginProvider, autoLinkUser.Id);
return SignInResult.NotAllowed;
}
else
{
return await LinkUser(autoLinkUser, loginInfo);
}

return await LinkUser(autoLinkUser, loginInfo);
}
else
Expand Down Expand Up @@ -226,7 +237,16 @@ private async Task<SignInResult> AutoLinkAndSignInExternalAccount(ExternalLoginI
}
else
{
return await LinkUser(autoLinkUser, loginInfo);
var shouldSignIn = autoLinkOptions.OnExternalLogin(autoLinkUser, loginInfo);
if (shouldSignIn == false)
{
Logger.LogWarning("The AutoLinkOptions of the external authentication provider '{LoginProvider}' have refused the login based on the OnExternalLogin method. Affected user id: '{UserId}'", loginInfo.LoginProvider, autoLinkUser.Id);
return SignInResult.NotAllowed;
}
else
{
return await LinkUser(autoLinkUser, loginInfo);
}
}
}
}
Expand Down

0 comments on commit cb15c2a

Please sign in to comment.