Skip to content

#230 - Use static path to find provider button's img#235

Merged
Gaetanbrl merged 1 commit intogeorchestra:mainfrom
jdev-org:issue-230-button-provider-img
Nov 14, 2025
Merged

#230 - Use static path to find provider button's img#235
Gaetanbrl merged 1 commit intogeorchestra:mainfrom
jdev-org:issue-230-button-provider-img

Conversation

@Gaetanbrl
Copy link
Copy Markdown
Contributor

@Gaetanbrl Gaetanbrl commented Nov 5, 2025

ref. issue #230

Description

This PR Introduced ProviderLogoResolver to centralize OAuth logo lookups according to datadir static directory (overrides) :

https://docs.georchestra.org/gateway/en/latest/user_guide/ui_customization/?h=thym#static-resources

  • Java doc
  • Tests

Here an example to use a custom png with franceconnect (boat) :

image

How to test ?

  1. Fetch branch
  2. Copy /templates into gateway's datadir
  3. Copy /static into previous datadir/gateway/templates
  4. Change datadir/gateway/application.yaml to use static (doc) ressources and templates (doc) :

in application.yaml, replace :

spring:
  cloud:

By :

spring:
  thymeleaf:
    prefix: file:${georchestra.datadir}/gateway/templates/
  web:
    resources:
      static-locations: file:${georchestra.datadir}/gateway/templates/static/
  webflux:
    static-path-pattern: /static/**
  cloud:
  1. Play with PNG located in datadir/gateway/templates/static/img

Example, if you set a franceconnect provider, use a png names franceconnect.png in templates/static directory.

@Gaetanbrl Gaetanbrl requested a review from f-necas November 5, 2025 15:17
@Gaetanbrl Gaetanbrl self-assigned this Nov 5, 2025
Copy link
Copy Markdown
Collaborator

@f-necas f-necas left a comment

Choose a reason for hiding this comment

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

You may have overengineered it.

You can access statc Location with :

 @Autowired(required = false)
    private WebProperties webProperties;

String[] locations = webProperties.getResources().getStaticLocations();
// ["classpath:/META...", "classpath:/reso...", "classpath:/stat...", "classpath:/publ...", "file:/home/..."]

Then we could iterate through paths in order to see in ClassPathResource if start with classpath: or FileSystemResource if start with file: .

This way we can order the lookup locaiton we want using the spring properties.

spring:
  web:
    resources:
      static-locations:  file:/etc/georchestra/gateway/resources/static/, classpath:/static/

@Gaetanbrl Gaetanbrl force-pushed the issue-230-button-provider-img branch from 325b1f4 to e2099a6 Compare November 14, 2025 12:53
@f-necas f-necas self-requested a review November 14, 2025 12:54
@Gaetanbrl
Copy link
Copy Markdown
Contributor Author

J'ai apporté les changements suite aux revues. Je reste en attente de retours.

@f-necas f-necas self-requested a review November 14, 2025 13:34
@Gaetanbrl Gaetanbrl merged commit cda079a into georchestra:main Nov 14, 2025
4 checks passed
@github-actions
Copy link
Copy Markdown

💚 All backports created successfully

Status Branch Result
2.0.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

github-actions bot added a commit that referenced this pull request Nov 14, 2025
[2.0.x] Merge pull request #235 from jdev-org/issue-230-button-provider-img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants