Skip to content

Commit

Permalink
Allowing the configuration of one main auth client in the config
Browse files Browse the repository at this point in the history
rh-pre-commit.version: 2.0.3
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
computate committed Dec 13, 2023
1 parent eb15561 commit 998e1e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1172,66 +1172,6 @@ public static String staticSearchFqUserEmail(SiteRequestEnUS siteRequest_, Strin
return PageLayout.staticSearchStrUserEmail(siteRequest_, PageLayout.staticSearchUserEmail(siteRequest_, PageLayout.staticSetUserEmail(siteRequest_, o)));
}

////////////////
// authClient //
////////////////


/** The entity authClient
* is defined as null before being initialized.
*/
@JsonProperty
@JsonInclude(Include.NON_NULL)
protected JsonObject authClient;

/** <br> The entity authClient
* is defined as null before being initialized.
* <br><a href="https://solr-solr.apps-crc.testing/solr/computate/select?q=*:*&fq=partEstEntite_indexed_boolean:true&fq=classeNomCanonique_enUS_indexed_string:org.computate.smartvillage.enus.page.PageLayout&fq=entiteVar_enUS_indexed_string:authClient">Find the entity authClient in Solr</a>
* <br>
* @param w is for wrapping a value to assign to this entity during initialization.
**/
protected abstract void _authClient(Wrap<JsonObject> w);

public JsonObject getAuthClient() {
return authClient;
}

public void setAuthClient(JsonObject authClient) {
this.authClient = authClient;
}
@JsonIgnore
public void setAuthClient(String o) {
this.authClient = PageLayout.staticSetAuthClient(siteRequest_, o);
}
public static JsonObject staticSetAuthClient(SiteRequestEnUS siteRequest_, String o) {
if(o != null) {
return new JsonObject(o);
}
return null;
}
protected PageLayout authClientInit() {
Wrap<JsonObject> authClientWrap = new Wrap<JsonObject>().var("authClient");
if(authClient == null) {
_authClient(authClientWrap);
Optional.ofNullable(authClientWrap.getO()).ifPresent(o -> {
setAuthClient(o);
});
}
return (PageLayout)this;
}

public static String staticSearchAuthClient(SiteRequestEnUS siteRequest_, JsonObject o) {
return o.toString();
}

public static String staticSearchStrAuthClient(SiteRequestEnUS siteRequest_, String o) {
return o == null ? null : o.toString();
}

public static String staticSearchFqAuthClient(SiteRequestEnUS siteRequest_, String o) {
return PageLayout.staticSearchStrAuthClient(siteRequest_, PageLayout.staticSearchAuthClient(siteRequest_, PageLayout.staticSetAuthClient(siteRequest_, o)));
}

///////////////
// logoutUrl //
///////////////
Expand Down Expand Up @@ -4430,7 +4370,6 @@ public Future<Void> promisePageLayout(Promise<Void> promise) {
userFullNameInit();
userNameInit();
userEmailInit();
authClientInit();
logoutUrlInit();
long0Init();
long1Init();
Expand Down Expand Up @@ -4607,8 +4546,6 @@ public Object obtainPageLayout(String var) {
return oPageLayout.userName;
case "userEmail":
return oPageLayout.userEmail;
case "authClient":
return oPageLayout.authClient;
case "logoutUrl":
return oPageLayout.logoutUrl;
case "long0":
Expand Down Expand Up @@ -4790,8 +4727,6 @@ public static Object staticSetPageLayout(String entityVar, SiteRequestEnUS siteR
return PageLayout.staticSetUserName(siteRequest_, o);
case "userEmail":
return PageLayout.staticSetUserEmail(siteRequest_, o);
case "authClient":
return PageLayout.staticSetAuthClient(siteRequest_, o);
case "logoutUrl":
return PageLayout.staticSetLogoutUrl(siteRequest_, o);
case "long0":
Expand Down Expand Up @@ -4936,8 +4871,6 @@ public static Object staticSearchPageLayout(String entityVar, SiteRequestEnUS si
return PageLayout.staticSearchUserName(siteRequest_, (String)o);
case "userEmail":
return PageLayout.staticSearchUserEmail(siteRequest_, (String)o);
case "authClient":
return PageLayout.staticSearchAuthClient(siteRequest_, (JsonObject)o);
case "logoutUrl":
return PageLayout.staticSearchLogoutUrl(siteRequest_, (String)o);
case "long0":
Expand Down Expand Up @@ -5082,8 +5015,6 @@ public static String staticSearchStrPageLayout(String entityVar, SiteRequestEnUS
return PageLayout.staticSearchStrUserName(siteRequest_, (String)o);
case "userEmail":
return PageLayout.staticSearchStrUserEmail(siteRequest_, (String)o);
case "authClient":
return PageLayout.staticSearchStrAuthClient(siteRequest_, (String)o);
case "logoutUrl":
return PageLayout.staticSearchStrLogoutUrl(siteRequest_, (String)o);
case "long0":
Expand Down Expand Up @@ -5228,8 +5159,6 @@ public static String staticSearchFqPageLayout(String entityVar, SiteRequestEnUS
return PageLayout.staticSearchFqUserName(siteRequest_, o);
case "userEmail":
return PageLayout.staticSearchFqUserEmail(siteRequest_, o);
case "authClient":
return PageLayout.staticSearchFqAuthClient(siteRequest_, o);
case "logoutUrl":
return PageLayout.staticSearchFqLogoutUrl(siteRequest_, o);
case "long0":
Expand Down Expand Up @@ -5362,7 +5291,6 @@ public static String staticSearchFqPageLayout(String entityVar, SiteRequestEnUS
public static final String VAR_userFullName = "userFullName";
public static final String VAR_userName = "userName";
public static final String VAR_userEmail = "userEmail";
public static final String VAR_authClient = "authClient";
public static final String VAR_logoutUrl = "logoutUrl";
public static final String VAR_long0 = "long0";
public static final String VAR_long1 = "long1";
Expand Down Expand Up @@ -5438,7 +5366,6 @@ public static String staticSearchFqPageLayout(String entityVar, SiteRequestEnUS
public static final String DISPLAY_NAME_userFullName = "";
public static final String DISPLAY_NAME_userName = "";
public static final String DISPLAY_NAME_userEmail = "";
public static final String DISPLAY_NAME_authClient = "";
public static final String DISPLAY_NAME_logoutUrl = "";
public static final String DISPLAY_NAME_long0 = "";
public static final String DISPLAY_NAME_long1 = "";
Expand Down Expand Up @@ -5539,8 +5466,6 @@ public static String displayNamePageLayout(String var) {
return DISPLAY_NAME_userName;
case VAR_userEmail:
return DISPLAY_NAME_userEmail;
case VAR_authClient:
return DISPLAY_NAME_authClient;
case VAR_logoutUrl:
return DISPLAY_NAME_logoutUrl;
case VAR_long0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,13 @@ protected void _userEmail(Wrap<String> w) {
w.o(siteRequest_.getUserEmail());
}

/**
* Description: The current user's email
*/
protected void _authClient(Wrap<JsonObject> w) {
JsonObject config = siteRequest_.getConfig();
w.o(config.getJsonObject(ConfigKeys.AUTH_CLIENTS).getJsonObject(config.getString(ConfigKeys.AUTH_CLIENT)));
}

/**
* Description: The logout URL
*/
protected void _logoutUrl(Wrap<String> w) {
try {
JsonObject config = siteRequest_.getConfig();
JsonObject config = siteRequest_.getConfig();
JsonObject authClient = Optional.ofNullable(config.getJsonObject(ConfigKeys.AUTH_CLIENTS)).map(authClients -> authClients.getJsonObject(config.getString(ConfigKeys.AUTH_CLIENT))).orElse(config);
w.o(authClient.getString(ConfigKeys.AUTH_URL) + "/realms/" + authClient.getString(ConfigKeys.AUTH_REALM) + "/protocol/openid-connect/logout?redirect_uri=" + URLEncoder.encode(config.getString(ConfigKeys.SITE_BASE_URL) + authClient.getString(ConfigKeys.AUTH_LOGOUT_URI), "UTF-8"));
} catch (UnsupportedEncodingException ex) {
ExceptionUtils.rethrow(ex);
Expand Down
10 changes: 6 additions & 4 deletions src/main/resources/templates/enUS/MapResultGenPage.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
{{#block "websocket"}}{{/block}}
});
function jsWebsocketMapResult(vars, $response) {
function jsWebsocketMapResult(, vars, $response) {
{{#block "jsWebsocket"}}{{/block}}
}
Expand All @@ -59,6 +59,10 @@
function htmTooltipMapResult(feature, layer) {
return `{{#block "htmTooltip"}}{{/block}}`;
}
function jsStyleMapResult(feature) {
{{#block "jsStyle"}}{{/block}}
}
</script>
{{/inline}}
{{#*inline "websocketMapResultPage"}}
Expand All @@ -68,9 +72,7 @@
{{#*inline "jsWebsocketMapResultPage"}}{{/inline}}
{{#*inline "jsTooltipMapResultPage"}}{{/inline}}
{{#*inline "htmTooltipMapResultPage"}}{{/inline}}
{{#partial "jsWebsocket"}}{{> jsWebsocketMapResultPage}}{{/partial}}
{{#partial "jsTooltip"}}{{> jsTooltipMapResultPage}}{{/partial}}
{{#partial "htmTooltip"}}{{> htmTooltipMapResultPage}}{{/partial}}
{{#*inline "jsStyleMapResultPage"}}{{/inline}}
{{#*inline "htmUrlMapResult"}}{{pageUri}}?q={{query.q}}&amp;rows={{#if rows}}{{rows}}{{else}}{{pagination.rows}}{{/if}}&amp;rows={{#if start}}{{start}}{{else}}{{pagination.start}}{{/if}}{{#each query.fq}}{{#eq fq this}}{{else}}&fq={{fq}}:{{val}}{{/eq}}{{/each}}{{#each query.sort}}{{#eq sort this}}{{else}}&sort={{var}} {{order}}{{/eq}}{{/each}}{{/inline}}
{{#*inline "htmHeadMapResultPage"}}{{#block "htmTitle"}}{{/block}}{{#block "htmMeta"}}{{/block}}{{#block "htmStyle"}}{{/block}}{{#block "htmScripts"}}{{/block}}{{#block "htmScript"}}{{/block}}{{/inline}}
{{#*inline "htmBodySearchMapResultPage"}} <!-- #*inline "htmBodySearchMapResultPage" -->
Expand Down

0 comments on commit 998e1e3

Please sign in to comment.