Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hangfire configuration and the recurring UserSessionJob #830

Open
dpoulsen21 opened this issue Jan 13, 2025 · 3 comments
Open

Hangfire configuration and the recurring UserSessionJob #830

dpoulsen21 opened this issue Jan 13, 2025 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@dpoulsen21
Copy link

We are finally upgrading to v5.x. For context see prior issue: #725

First question:

I'm trying to upgrade to the 5.0.0 packages first. We aren't using back channel authentication, so Hangfire is not being pulled in. I can add the service manually, but then the UserSessionJob keeps firing every 10-15 seconds. I can kill the job, but I'd rather disable Hangfire altogether.

I feel like adding a flag to the following lines (or moving them to the IsBCEnabled section) in SimpleIdServer.IdServer's WebApplicationExtension.cs would make that possible:

var reccuringJobManager = webApplication.Services.GetRequiredService();
// Occurs every 10 seconds.
reccuringJobManager.AddOrUpdate(nameof(UserSessionJob), j => webApplication.Services.GetRequiredService().Execute(), "*/10 * * * * *");

If Hangfire is necessary regardless of whether or not back channel authentication is enabled, is there a way to configure it so we have some control over what background jobs are created, whether they are recurring or fire and forget, the time in between firing, etc.?

Second question/issue:

I tried to upgrade directly to the 5.2.0 packages (NuGet packages used: SimpleIdServer.IdServer and SimpleIdServer.IdServer.SqlServerMigrations), but I received the following dependency injection error:

5-0-2_Error

I feel like the DI should be handled in the package and not inside our application builder, but I could be wrong. I decided to start with v5.0.0, since that code doesn't include that AuthorizationCallbackRequestHandler class. Plan to upgrade incrementally after, but figured I might as well ask about that while I'm here.

@simpleidserver
Copy link
Owner

Hello,

First question:
Even if you are not using the Back-Channel Authentication method, the Hangfire library is still utilized by the UserSessionJob class to revoke user sessions across different clients by calling their respective BackChannelLogoutUri.
This class is necessary to support the OpenID Connect Back-Channel Logout 1.0 specification (https://openid.net/specs/openid-connect-backchannel-1_0.html).

To view the configuration of the recurring job, you can access the Hangfire dashboard. To enable this feature, edit the Program.cs file and add the following instruction before UseSID:

app.UseHangfireDashboard();
app.UseSID()

Sample project : https://github.com/simpleidserver/SimpleIdServer/tree/Release503/samples/AddHangfireUi

Unfortunately, at the moment, it is not possible to edit the cron expressions of the different jobs. I have created a new ticket to support this feature: Ticket#831.

Second question :

Indeed, the configuration of the IDidFactoryResolver service should be moved to our application builder.
I have created a new ticket to move this configuration to a more appropriate location: Ticket#832.

In the meantime, can you add the missing registration as follows?

services.AddDid()

KR,

SID

@simpleidserver simpleidserver self-assigned this Jan 14, 2025
@simpleidserver simpleidserver added the question Further information is requested label Jan 14, 2025
@dpoulsen21
Copy link
Author

Thank you for the reply. I will take a look at the dashboard. I'll need to reach out to our Cyber department to find out if that's something we can even deploy to Production. I can definitely add the registration in the meantime. Do you have an idea when the v5.0.3 packages might be available?

@simpleidserver
Copy link
Owner

Hello,

The version 5.0.3 will be published by the end of the month! 🙂

Next month, we’ll release version 6.0.0, which introduces a new feature: a form builder.

This feature will allow you to customize the UI and workflow for authentication and registration.

KR
SID

@simpleidserver simpleidserver moved this to Todo in Release 5.0.3 Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: Todo
Development

No branches or pull requests

2 participants