Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rickbutterfield committed Nov 8, 2021
1 parent 1117440 commit b00e686
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 b00e686

Please sign in to comment.