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

feat: update all occurences of 'MonComptePro' #33

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ PORT: 3000
SITE_TITLE: "Bonjour monde !"
STYLESHEET_URL: https://unpkg.com/bamboo.css
CALLBACK_URL: /login-callback
MCP_CLIENT_ID: client_id
MCP_CLIENT_SECRET: client_secret
MCP_PROVIDER: https://app-sandbox.moncomptepro.beta.gouv.fr/
MCP_SCOPES: "openid email profile organization"
PC_CLIENT_ID: client_id
PC_CLIENT_SECRET: client_secret
PC_PROVIDER: https://app-sandbox.moncomptepro.beta.gouv.fr/
PC_SCOPES: "openid email profile organization"
LOGIN_HINT: ""
MCP_ID_TOKEN_SIGNED_RESPONSE_ALG: RS256
MCP_USERINFO_SIGNED_RESPONSE_ALG: ""
PC_ID_TOKEN_SIGNED_RESPONSE_ALG: RS256
PC_USERINFO_SIGNED_RESPONSE_ALG: ""
ACR_VALUES: ""
SESSION_SECRET: CeciEstUnFauxSecret
ACR_VALUE_FOR_2FA: "https://proconnect.gouv.fr/assurance/consistency-checked-2fa"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/numerique-gouv/moncomptepro-test-client
images: ghcr.io/numerique-gouv/proconnect-test-client
tags: |
type=sha,format=long,prefix=
type=ref,event=branch
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# MonComptePro Test Client
# ProConnect Test Client

This is a minimal, nodeJS-based MonComptePro client, to be used for end-to-end testing.
This is a minimal, nodeJS-based ProConnect client, to be used for end-to-end testing.

It uses the https://github.com/panva/node-openid-client Library for the actual OIDC Logic.

This tool can be used to test the traditional Authorization Code Flow.

It also uses the `select_organization` & `update_userinfo` MonComptePro prompts.
It also uses the `select_organization` & `update_userinfo` ProConnect prompts (available only on ProConnect Identité).

This tool is full configured using environment variables.
This tool is fully configured using environment variables.

## Run it with Docker

Pull the image:

```
docker pull ghcr.io/numerique-gouv/moncomptepro-test-client
docker pull ghcr.io/numerique-gouv/proconnect-test-client
```

Run the container:
Expand All @@ -24,7 +24,7 @@ Run the container:
docker run --rm \
-p 3000:3000 \
-e PORT=3000 \
ghcr.io/numerique-gouv/moncomptepro-test-client
ghcr.io/numerique-gouv/proconnect-test-client
```

## Run it with Docker Compose
Expand All @@ -36,7 +36,7 @@ version: "3.5"

services:
oidc-test-client:
image: rdubigny/moncomptepro-test-client
image: numerique-gouv/proconnect-test-client
ports:
- 3000:3000
environment:
Expand Down
12 changes: 6 additions & 6 deletions agentconnect.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ PORT: 3000
SITE_TITLE: "Bonjour monde !"
STYLESHEET_URL: https://unpkg.com/bamboo.css
CALLBACK_URL: /login-callback
MCP_CLIENT_ID: client_id_localhost:3000
MCP_CLIENT_SECRET: client_secret_localhost:3000
MCP_PROVIDER: https://fca.integ01.dev-agentconnect.fr/api/v2
MCP_SCOPES: "openid given_name usual_name email phone uid siren siret idp_id idp_acr is_public_service"
PC_CLIENT_ID: client_id_localhost:3000
PC_CLIENT_SECRET: client_secret_localhost:3000
PC_PROVIDER: https://fca.integ01.dev-agentconnect.fr/api/v2
PC_SCOPES: "openid given_name usual_name email phone uid siren siret idp_id idp_acr is_public_service"
LOGIN_HINT: ""
MCP_ID_TOKEN_SIGNED_RESPONSE_ALG: RS256
MCP_USERINFO_SIGNED_RESPONSE_ALG: RS256
PC_ID_TOKEN_SIGNED_RESPONSE_ALG: RS256
PC_USERINFO_SIGNED_RESPONSE_ALG: RS256
ACR_VALUES: eidas1
SESSION_SECRET: CeciEstUnFauxSecret
SHOW_AGENTCONNECT_BUTTON: true
2 changes: 1 addition & 1 deletion e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default defineConfig({
supportFile: false,
},
env: {
MCP_PROVIDER: process.env.MCP_PROVIDER,
PC_PROVIDER: process.env.PC_PROVIDER,
},
});

Expand Down
6 changes: 3 additions & 3 deletions e2e/features/connexion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Fonctionnalité: Connexion de [email protected]
Alors je vois "Bonjour monde !"
Quand je clique sur le bouton ProConnect

Quand je me connecte en tant que [email protected] sur moncomptepro
Et je vois "Votre organisation de rattachement" sur moncomptepro
Et je clique sur "Continuer" sur moncomptepro
Quand je me connecte en tant que [email protected] sur ProConnect
Et je vois "Votre organisation de rattachement" sur ProConnect
Et je clique sur "Continuer" sur ProConnect

Alors je suis redirigé sur "/"
Et je vois "Information utilisateur"
Expand Down
12 changes: 6 additions & 6 deletions e2e/features/connexion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ Then("je vois {string}", function (text: string) {

//

When("je vois {string} sur moncomptepro", (_text: string) => {
cy.origin(Cypress.env("MCP_PROVIDER"), { args: _text }, (text) => {
When("je vois {string} sur ProConnect", (_text: string) => {
cy.origin(Cypress.env("PC_PROVIDER"), { args: _text }, (text) => {
cy.contains(text);
});
});

When("je clique sur {string} sur moncomptepro", (_text: string) => {
cy.origin(Cypress.env("MCP_PROVIDER"), { args: _text }, (text) => {
When("je clique sur {string} sur ProConnect", (_text: string) => {
cy.origin(Cypress.env("PC_PROVIDER"), { args: _text }, (text) => {
cy.contains(text).click();
});
});

When(
"je me connecte en tant que [email protected] sur moncomptepro",
"je me connecte en tant que [email protected] sur ProConnect",
(path: string) => {
cy.origin(Cypress.env("MCP_PROVIDER"), () => {
cy.origin(Cypress.env("PC_PROVIDER"), () => {
cy.get('[name="login"]').type("[email protected]");
cy.get('[type="submit"]').click();

Expand Down
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const app = express();
app.set("view engine", "ejs");
app.use(
session({
name: "mcp_session",
name: "pc_session",
secret: process.env.SESSION_SECRET,
rolling: true,
}),
Expand All @@ -25,24 +25,24 @@ app.use(morgan("combined"));
const removeNullValues = (obj) => Object.entries(obj).reduce((a,[k,v]) => (v ? (a[k]=v, a) : a), {})

const getMcpClient = async () => {
const mcpIssuer = await Issuer.discover(process.env.MCP_PROVIDER);
const mcpIssuer = await Issuer.discover(process.env.PC_PROVIDER);

return new mcpIssuer.Client({
client_id: process.env.MCP_CLIENT_ID,
client_secret: process.env.MCP_CLIENT_SECRET,
client_id: process.env.PC_CLIENT_ID,
client_secret: process.env.PC_CLIENT_SECRET,
redirect_uris: [redirectUri],
response_types: ["code"],
id_token_signed_response_alg: process.env.MCP_ID_TOKEN_SIGNED_RESPONSE_ALG,
id_token_signed_response_alg: process.env.PC_ID_TOKEN_SIGNED_RESPONSE_ALG,
userinfo_signed_response_alg:
process.env.MCP_USERINFO_SIGNED_RESPONSE_ALG || null,
process.env.PC_USERINFO_SIGNED_RESPONSE_ALG || null,
});
};

const acr_values = process.env.ACR_VALUES
? process.env.ACR_VALUES.split(",")
: null;
const login_hint = process.env.LOGIN_HINT || null;
const scope = process.env.MCP_SCOPES;
const scope = process.env.PC_SCOPES;
const AUTHORIZATION_DEFAULT_PARAMS = {
scope,
login_hint,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "moncomptepro-test-client",
"name": "proconnect-test-client",
"version": "1.0.0",
"description": "This is a minimal, nodeJS-based MonComptePro client, to be used for end-to-end testing.",
"homepage": "https://github.com/rdubigny/moncomptepro-test-client#readme",
"description": "This is a minimal, nodeJS-based ProConnect client, to be used for end-to-end testing.",
"homepage": "https://github.com/numerique-gouv/proconnect-test-client#readme",
"bugs": {
"url": "https://github.com/rdubigny/moncomptepro-test-client/issues"
"url": "https://github.com/numerique-gouv/proconnect-test-client/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/rdubigny/moncomptepro-test-client.git"
"url": "git+https://github.com/numerique-gouv/proconnect-test-client.git"
},
"license": "AGPL-3.0",
"author": "",
Expand Down
4 changes: 2 additions & 2 deletions publishing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Publishing docker image

```
docker build -t numerique-gouv/moncomptepro-test-client .
docker build -t numerique-gouv/proconnect-test-client .
```

Authenticate to the github docker registery:
Expand All @@ -11,5 +11,5 @@ https://docs.github.com/en/packages/working-with-a-github-packages-registry/work
Then

```
docker push ghcr.io/numerique-gouv/moncomptepro-test-client
docker push ghcr.io/numerique-gouv/proconnect-test-client
```
4 changes: 2 additions & 2 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width"/>
<title><%= locals.title %> - MonComptePro</title>
<title><%= locals.title %> - ProConnect</title>
<style>
.proconnect-sr-only {
position: absolute;
Expand Down Expand Up @@ -113,7 +113,7 @@
</details>
</main>
<footer>
<p>Source: <a href="https://github.com/numerique-gouv/moncomptepro-test-client">github.com/numerique-gouv/moncomptepro-test-client</a></p>
<p>Source: <a href="https://github.com/numerique-gouv/proconnect-test-client">github.com/numerique-gouv/proconnect-test-client</a></p>
</footer>
</body>
</html>