Skip to content

Conversation

@warwickschroeder
Copy link

@warwickschroeder warwickschroeder commented Nov 24, 2025

Addresses: #1723

  • Supports JWT bearer tokens, OpenID Connect, OAuth2.0.
  • Uses Authorisation Code OAuth2 grant type
  • Authentication config is fed from the ServiceControl API. Defaults to disabled.
  • Adds config for direct HTTPS hosting. Defaults to disabled.
  • Adds config for HTTPS redirect and HSTS
  • Adds config for Forward Headers (reverse proxy). Defaults to "All" headers and "Any" proxies.
  • Add unit and acceptance tests for the windows service (.net framework) host and the container (.net8) host

@jasontaylordev jasontaylordev changed the title Add initial authentication Add initial authentication to ServicePulse Nov 25, 2025
@warwickschroeder warwickschroeder force-pushed the genxp-3600-add-authentication branch from da0cc40 to 787ab48 Compare November 26, 2025 07:36
@jasontaylordev jasontaylordev force-pushed the genxp-3600-add-authentication branch 2 times, most recently from 48fcaed to c5d166e Compare December 1, 2025 04:53
@warwickschroeder warwickschroeder changed the title Add initial authentication to ServicePulse Add authentication and SSL/TLS to ServicePulse Dec 10, 2025
@warwickschroeder warwickschroeder marked this pull request as ready for review December 17, 2025 01:10
@jasontaylordev jasontaylordev force-pushed the genxp-3600-add-authentication branch from 559660c to 62dd485 Compare January 8, 2026 06:44
@warwickschroeder warwickschroeder force-pushed the genxp-3600-add-authentication branch from 6abcbdc to 477556a Compare January 15, 2026 04:12

## Prerequisites

- ServicePulse built locally (see main README for build instructions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ServicePulse built locally (see main README for build instructions)
- ServicePulse built locally (see [main README for instructions](../README.md#setting-up-the-project-for-development))


## Prerequisites

- ServicePulse built locally (see main README for build instructions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ServicePulse built locally (see main README for build instructions)
- ServicePulse built locally (see [main README for instructions](../README.md#setting-up-the-project-for-development))

## .NET 8 Prerequisites

- [mkcert](https://github.com/FiloSottile/mkcert) for generating local development certificates
- ServicePulse built locally (see main README for build instructions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ServicePulse built locally (see main README for build instructions)
- ServicePulse built locally (see [main README for instructions](../README.md#setting-up-the-project-for-development))


- [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed and running
- [mkcert](https://github.com/FiloSottile/mkcert) for generating local development certificates
- ServicePulse built locally (see main README for build instructions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ServicePulse built locally (see main README for build instructions)
- ServicePulse built locally (see [main README for instructions](../README.md#setting-up-the-project-for-development))


This guide provides scenario-based tests for ServicePulse's OIDC authentication. Use this to verify authentication behavior during local development.

For additional details on authentication in ServicePulse, see the [ServicePulse Security](https://docs.particular.net/servicepulse/security/configuration/authentication).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For additional details on authentication in ServicePulse, see the [ServicePulse Security](https://docs.particular.net/servicepulse/security/configuration/authentication).
For additional details on authentication in ServicePulse, see the [ServicePulse Security](https://docs.particular.net/servicepulse/security/configuration/authentication) documentation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to SC PR, this file can probably be removed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to SC PR, this file can probably be removed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to SC PR, this file can probably be removed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to SC PR, this file can probably be removed


This guide provides scenario-based tests for ServicePulse's direct HTTPS features. Use this to verify HTTPS behavior without a reverse proxy.

> [!NOTE] HTTP to HTTPS redirection (`RedirectHttpToHttps`) is designed for reverse proxy scenarios where the proxy forwards HTTP requests to ServicePulse. When running with direct HTTPS, ServicePulse only binds to a single port (HTTPS). To test HTTP to HTTPS redirection, see [Reverse Proxy Testing](nginx-testing.md). HSTS should not be tested on localhost because browsers cache the HSTS policy, which could break other local development. To test HSTS, use the [NGINX reverse proxy setup](nginx-testing.md) with a custom hostname (`servicepulse.localhost`).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> [!NOTE] HTTP to HTTPS redirection (`RedirectHttpToHttps`) is designed for reverse proxy scenarios where the proxy forwards HTTP requests to ServicePulse. When running with direct HTTPS, ServicePulse only binds to a single port (HTTPS). To test HTTP to HTTPS redirection, see [Reverse Proxy Testing](nginx-testing.md). HSTS should not be tested on localhost because browsers cache the HSTS policy, which could break other local development. To test HSTS, use the [NGINX reverse proxy setup](nginx-testing.md) with a custom hostname (`servicepulse.localhost`).
> [!NOTE]
> HTTP to HTTPS redirection (`RedirectHttpToHttps`) is designed for reverse proxy scenarios where the proxy forwards HTTP requests to ServicePulse. When running with direct HTTPS, ServicePulse only binds to a single port (HTTPS). To test HTTP to HTTPS redirection, see [Reverse Proxy Testing](nginx-testing.md). HSTS should not be tested on localhost because browsers cache the HSTS policy, which could break other local development. To test HSTS, use the [NGINX reverse proxy setup](nginx-testing.md) with a custom hostname (`servicepulse.localhost`).

Copy link
Member

@johnsimons johnsimons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the vue code and left a few comments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered using TypeScript to create this rule?
It seems you can do it with https://typescript-eslint.io/developers/custom-rules

Comment on lines +9 to +10
position: relative;
z-index: 1000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we have to change this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need these changes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this file added back?
As part of the refactoring @phase and I did, we removed this.

<div class="logged-out-content">
<h1 class="logged-out-title">You have been signed out</h1>
<p class="logged-out-message">You have successfully signed out of ServicePulse.</p>
<button v-if="authEnabled" type="button" class="btn btn-primary sign-in-button" @click="handleSignIn">Sign in again</button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If authEnabled is false, doesn't that mean auth is disabled and hence why would we be rendering this view at all?

</div>
</div>
<div v-else-if="isAuthenticating" class="loading-overlay">
<div class="loading-spinner">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should be using the existing LoadingSpinner component?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what this would look like if we were to wrap App with some other AuthApp component?
So instead of modifying App and add the auth to it, we would create a new AuthApp component that does the auth and then displays <App />.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem to be need?

uses: actions/setup-dotnet@v5.1.0
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're bumping the major of .net.
So we need to bump our major too?

enabled: boolean;
client_id: string;
authority: string;
api_scopes: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a string[]?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants