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

Allow customization of QR code page #713

Open
esune opened this issue Jan 27, 2025 · 4 comments · May be fixed by #715
Open

Allow customization of QR code page #713

esune opened this issue Jan 27, 2025 · 4 comments · May be fixed by #715
Assignees
Labels
enhancement New feature or request

Comments

@esune
Copy link
Member

esune commented Jan 27, 2025

In order to support custom UX for the QR code page, it needs to be possible to replace the default page and assets.

There are two options to do this:

  • (Preferred) Adding a volume with the appropriate resources (HTML, CSS, JS) to the container and having a configuration parameter tell the app where to find the resource files.
  • Allow for resources to be replaced in the container with a custom (downstream) build step, ensuring that the expected resources are available in the target directory.

Custom resources for the QR page should always include an HTML page, with CSS and JS resources either defined inline or referenced. This should allow support for more complex SPAs that can be built separately and then injected into the deployment.

@esune esune added the enhancement New feature or request label Jan 27, 2025
@esune esune moved this to Assigned in CDT Enterprise Apps Jan 28, 2025
@esune
Copy link
Member Author

esune commented Jan 29, 2025

@Gavinok one note worth mentioning (thanks @loneil for reminding me): the QR page is served via a get endpoint as it needs to be processed by the server using a Jinja template to inject the values relevant for the transaction (namely the URL that the QR code will link to). We need to ensure this step is retained so that all variables exposed by the vc-authn service can be referenced and correctly resolved when rendering a template, even if it is a custom one.

@Gavinok
Copy link
Contributor

Gavinok commented Jan 29, 2025

Here are some general plans for this ticket

We want to make the directory and template file into env vars and use a helm volume replacing the templates directory for user defined static element.

Location that needs to be made into a env var https://github.com/bcgov/vc-authn-oidc/blob/main/oidc-controller/api/main.py#L51

How we currently import user_variable_substitution.py here https://github.com/bcgov/vc-authn-oidc/blob/main/charts/vc-authn-oidc/templates/configmap.yaml#L9

Make the directory configurable here https://github.com/bcgov/vc-authn-oidc/blob/main/charts/vc-authn-oidc/values.yaml

Add a new volume here https://github.com/bcgov/vc-authn-oidc/blob/main/charts/vc-authn-oidc/templates/deployment.yaml#L39

The mount this new volume here https://github.com/bcgov/vc-authn-oidc/blob/main/charts/vc-authn-oidc/templates/deployment.yaml#L132

volumes:
  - name: jwt-token
    secret:
      secretName: {{ include "vc-authn-oidc.token.secretName" . }}
      defaultMode: 256
  - name: controller-config
    configMap:
      name: {{ include "global.fullname" . }}-controller-config
  - name: template
    emptyDir: {}
containers:
  - name: {{ include "global.fullname" . }}
    image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
    imagePullPolicy: {{ .Values.image.pullPolicy }}
    volumeMounts:
      - name: template
        mountPath: /path/to/template

As far as the handling of passing values into templates a formal api will be outlined on the exposed variables

Users will be responsible for making use of these exposed variables in their templates.

@Gavinok
Copy link
Contributor

Gavinok commented Jan 29, 2025

@esune Since these exposed values are compiled at runtime these templates can be replaced at any time as long as the assets needed are configured https://github.com/bcgov/vc-authn-oidc/blob/main/charts/vc-authn-oidc/values.yaml so that all the templates can access the associated js/css/etc

@Gavinok
Copy link
Contributor

Gavinok commented Feb 3, 2025

I have decided that the best mode of action would be to now extract the QR code functionality into separate files to allow for the core styling to be modified by users.

@esune esune moved this from Assigned to In Progress in CDT Enterprise Apps Feb 4, 2025
@Gavinok Gavinok linked a pull request Feb 6, 2025 that will close this issue
@Gavinok Gavinok moved this from In Progress to In Review in CDT Enterprise Apps Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants