- Steps to reproduce the issue: UPgraded project from 9.0.4 to 9.2.3 version of Volo. We had Helper override methods for class "ExternalProviderSettingsHelper". We need them to save tenant specific external login settings. GetByNameAsync(string name, bool fallBackToHost = false) and public override async Task SetAsync(List<ExternalProviderSettings> settings) not working now. Please help.
66 Answer(s)
-
0
Can we work with current DB by clearing few tables. That will be easy for us to debug.
The project is http://dev.approach.cpat.dev and http://cpattest.dev.approach.cpat.dev
-
0
hi
You can remove all settings of
Abp.Account.ExternalProviders
,Then add them in your setting page again.After that, everything will work.
Because the template project is no problem.
Thanks.
-
0
Should I remove from table as well ? I removed the
Shared_TMSExternalProviderSettingsHelper : IExternalLoginProvider
class. -
0
Yes, remove setting values from database and your custom class.
Remember clear redis.
Add new external login info again.
Thanks
-
0
We have public class
CustomLoginModel : LoginModel
in theAuth server
it is referring toExternalProviders
. base class still needs ExternalProviders reference. Should I removeCustomLoginModel
class ?CustomLoginModel
is referred inLogin.cshtml
Deleted table data and removed the Shared_TMSExternalProviderSettingsHelper class. I couldn't remove CustomLoginModel.cs due to existing dependencies, as mentioned earlier. The database records have now been cleaned and the Redis cache cleared. Result: -The tenant is no longer able to read external provider data. :-( -Host admin can read external provider data fine.
DB does NOT look right: Now the save is not working after clearing cache.
Select Save->switch to Audit Logs->Switch back to settings.
-
0
hi
If you need, you can inject the
ExternalProviderSettingsHelper
service. -
0
hi
Can you test your case in a new template project?
The logic here are:
- If your tenant setting values are the same as the host, the tenant setting will be empty. But the external login feature will no problem.
- The host and the tenant can enable external login separately.
- Host: Enable/disable external logins and control which external logins can be used by tenants
- Tenant: Enable/disable the external login the host allows it to use.
-
0
[maliming] said:
Where should I inject ExternalProviderSettingsHelper service ?
I emailed you the code of Shared_TMSExternalProviderSettingsHelper class. I deleted that class in the 9.2.3 upgrade project,
-
0
[maliming] said: hi
Can you test your case in a new template project?
The logic here are:
- If your tenant setting values are the same as the host, the tenant setting will be empty. But the external login feature will no problem.
- The host and the tenant can enable external login separately.
- Host: Enable/disable external logins and control which external logins can be used by tenants
- Tenant: Enable/disable the external login the host allows it to use.
Let me try this now.
-
0
[sghorakavi@cpat.com] said:
[maliming] said: hi
Can you test your case in a new template project?
The logic here are:
- If your tenant setting values are the same as the host, the tenant setting will be empty. But the external login feature will no problem.
- The host and the tenant can enable external login separately.
- Host: Enable/disable external logins and control which external logins can be used by tenants
- Tenant: Enable/disable the external login the host allows it to use.
Let me try this now.
With template project, I have issue to login as tenant.:
-Logged in to host - Created external login separate option -- Created tenant -Login to tenant from host admin getting below error.
-
0
hi Try to use dotnet run command to start your web app.
-
0
-
0
The new website port is 44396
Please use the website url.
-
0
-
0
hi
Please use dotnet run command to start all websites.
Thanks
-
0
-
0
hi
You need to remove your custom
Shared_TMSExternalProviderSettingsHelper
and clear the setting value ofAbp.Account.ExternalProviders
Then upgrade to 9.3.x. Everything will work.
Thanks..
-
0
[maliming] said: hi
You need to remove your custom
Shared_TMSExternalProviderSettingsHelper
and clear the setting value ofAbp.Account.ExternalProviders
Then upgrade to 9.3.x. Everything will work.
Thanks..
- I removed Shared_TMSExternalProviderSettingsHelper class,
- cleared tables. Reset data seed.
Note: We have a class
CustomLoginModel : LoginModel
. This class has reference toVolo.Abp.Account.ExternalProviders.
Injecting
IAccountExternalProviderAppService
It is
AuthServer\Pages\Account\CustomLoginModel.cs
Location. How should I handle this class? -
0
hi
Please share your
CustomLoginModel
code.liming.ma@volosoft.com
Thanks
-
0
[maliming] said: liming.ma@volosoft.com
Sent you pls check
-
0
hi
Your
CustomLoginModel
won't affect theExternalProviderSettingsHelper
.You can continue to keep it.
Thanks.
-
0
[maliming] said: hi
Your
CustomLoginModel
won't affect theExternalProviderSettingsHelper
.You can continue to keep it.
Thanks.
In that case, http://dev.approach.cpat.dev has that code. // It gets SSO fine
Please check http://cpattest.dev.apprch.cpat.dev //Does not save SSO information for Extrernal Login
The code is not failing but NOT saving tenant specific external provider data:
-
0
hi
How can I reproduce this locally?
Can you share the code?
Thanks
-
0
Added following in HostModule.cs
private static void ConfigureExternalProviders(ServiceConfigurationContext context)
{
context.Services
.AddDynamicExternalLoginProviderOptions<PingOneAuthenticationOptions>(
PingOneAuthenticationDefaults.AuthenticationScheme,
// (options, serviceProvider, tenantId) =>
options =>
{
options.WithProperty(x => x.ClientId);
options.WithProperty(x => x.ClientSecret, isSecret: true);
options.WithProperty(x => x.AuthorizationEndpoint);
options.WithProperty(x => x.TokenEndpoint);
options.WithProperty(x => x.UserInformationEndpoint);
}
)
.AddDynamicExternalLoginProviderOptions<MicrosoftAccountOptions>(
MicrosoftAccountDefaults.AuthenticationScheme,
options =>
{
options.WithProperty(x => x.AuthorizationEndpoint);
options.WithProperty(x => x.TokenEndpoint);
options.WithProperty(x => x.ClientId);
options.WithProperty(x => x.ClientSecret, isSecret: true);
}
);
}
AuthServer Module has following for external login
context.Services.AddAuthentication()
.AddPingOne(options =>
{
// Common options
options.SaveTokens = true;
options.SignInScheme = IdentityConstants.ExternalScheme;
options.EnvironmentId = "Dynamic";
options.CallbackPath = "/signin-pingone";
// read tenant specific data
//scope
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add("offline_access");
}).WithDynamicOptions<PingOneAuthenticationOptions, PingOneAuthenticationHandler>(
"PingOne",
options =>
{
options.WithProperty(x => x.ClientId);
options.WithProperty(x => x.ClientSecret, isSecret: true);
options.WithProperty(x => x.AuthorizationEndpoint);
options.WithProperty(x => x.TokenEndpoint);
options.WithProperty(x => x.UserInformationEndpoint);
}
)
.AddMicrosoftAccount(MicrosoftAccountDefaults.AuthenticationScheme, options =>
{
//Personal Microsoft accounts as an example.
options.AuthorizationEndpoint = "https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize";
options.TokenEndpoint = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token";
options.ClaimActions.MapCustomJson("picture", _ => "https://graph.microsoft.com/v1.0/me/photo/$value");
options.SaveTokens = true;
})
.WithDynamicOptions<MicrosoftAccountOptions, MicrosoftAccountHandler>(
MicrosoftAccountDefaults.AuthenticationScheme,
options =>
{
options.WithProperty(x => x.TokenEndpoint);
options.WithProperty(x => x.AuthorizationEndpoint);
options.WithProperty(x => x.ClientId);
options.WithProperty(x => x.ClientSecret, isSecret: true);
}
);
I will try to create a sample but pls review code above. Is there a way to put some logs for you to debug ?
Thank you
-
0
hi
Can you share your test project so I can reproduce it?
Thanks.