Skip to content

Commit

Permalink
Url Fix (#125)
Browse files Browse the repository at this point in the history
* update resource provider to pull in the realm id not the realm display name (sorry for all the autoformats)

* avoid injecting empty style or undefined

* always display an org name

* format based on google formatting
  • Loading branch information
pnzrr authored Jan 10, 2024
1 parent 4bb536b commit c084947
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ First, setup:
yarn
```

Then, start a Keycloak, create a public OIDC client with `http://localhost:3000` Root URL, and update the `public/keycloak.json` file with the client config.
Then, start a Keycloak server (use hosted [Phase Two](https://phasetwo.io/dashboard/) for easy testing), create a public OIDC client with `http://localhost:3000` Root URL, and update the `public/keycloak.json` file with the client config.

Finally, run the development server:

```bash
yarn start
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You mill most likely need to use the fully qualified portal url [http://localhost:3000/auth/realms/master/portal](http://localhost:3000/auth/realms/master/portal).

### Build the extension

Expand Down
6 changes: 4 additions & 2 deletions ext/main/java/io/phasetwo/portal/PortalResourceProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,15 @@ public Response portal() {
Optional.ofNullable(realm.getAttribute("_providerConfig.assets.favicon.url"))
.orElse(
String.format(
"%s/realms/%s/portal/favicon.ico", authUrlAttribute, realmName)))
"%s/realms/%s/portal/favicon.ico",
authUrlAttribute, realm.getName())))
.setAttribute(
"appiconUrl",
Optional.ofNullable(realm.getAttribute("_providerConfig.assets.appicon.url"))
.orElse(
String.format(
"%s/realms/%s/portal/logo192.png", authUrlAttribute, realmName)))
"%s/realms/%s/portal/logo192.png",
authUrlAttribute, realm.getName())))
.setAttribute("displayName", realmName)
.setAttribute("realmName", realm.getName());
FreeMarkerLoginFormsProvider fm = (FreeMarkerLoginFormsProvider) form;
Expand Down
7 changes: 5 additions & 2 deletions src/components/utils/injectStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ const InjectStyles = () => {
const customStyles = `
${primaryColor}
${secondaryColor}
${styles.customCSS}
${styles.customCSS || ""}
`
.replace(/\r?\n/g, " ")
.replace(/\s+/g, " ")
.trim();

styleElement.innerHTML = customStyles;
document.body.appendChild(styleElement);

if (customStyles) {
document.body.appendChild(styleElement);
}

return () => {
document.body.removeChild(styleElement);
Expand Down
4 changes: 3 additions & 1 deletion src/pages/organizations/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export default function OrganizationSettings() {
items={[
{ title: t("organizations"), link: `/organizations` },
{
title: `${org?.displayName || t("organization")}`.trim(),
title: `${
org?.displayName || org?.name || t("organization")
}`.trim(),
link: `/organizations/${orgId}/details`,
},
]}
Expand Down

0 comments on commit c084947

Please sign in to comment.