Skip to content

Commit

Permalink
fix(jans-auth-server):show localizedStrings in html
Browse files Browse the repository at this point in the history
  • Loading branch information
jmunozherbas committed Jul 14, 2022
1 parent e623771 commit 5cdc834
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.*;

/**
* @author Javier Rojas Blum
Expand Down Expand Up @@ -1314,4 +1311,17 @@ public String getDescription() {
public void setDescription(String description) {
this.description = description;
}

public String getDisplayLocalizedString(LocalizedString localizedString) {
if (localizedString != null || !localizedString.getValues().isEmpty()) {
if (localizedString.getValues().keySet().contains("")) {
return localizedString.getValues().get("");
} else {
for (String fisrtValue : localizedString.getValues().values()) {
return fisrtValue;
}
}
}
return "";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<h:outputText value="#{msgs['authorize.requestForPermission']}" />
</h3>
<h:panelGroup layout="block" class="border_rad"
rendered='#{!empty client.getLogoUri()}'>
<h:graphicImage url='#{client.getLogoUri()}' width="65px"
rendered='#{!empty client.getDisplayLocalizedString(client.getLogoUri())}'>
<h:graphicImage url='#{client.getDisplayLocalizedString(client.getLogoUri())}' width="65px"
height="65px" />
</h:panelGroup>

Expand All @@ -46,7 +46,7 @@
<h:outputFormat
value="#{msgs['authorize.requestingPermissionForScopes']}">
<f:param
value="#{empty client.getClientName()? client.getClientId() : client.getClientName()}" />
value="#{empty client.getDisplayLocalizedString(client.getClientName())? client.getClientId() : client.getDisplayLocalizedString(client.getClientName())}" />
</h:outputFormat>
</p>
</h3>
Expand Down Expand Up @@ -100,19 +100,19 @@
</p>
</h:panelGroup>
<h:panelGroup layout="block"
rendered='#{!empty client.getPolicyUri()}'>
rendered='#{!empty client.getDisplayLocalizedString(client.getPolicyUri())}'>
<p>
<h:outputText value="#{msgs['common.agreePolicy']}" />
<a target="_blank" href='#{client.getPolicyUri()}'> <h:outputText
<a target="_blank" href='#{client.getDisplayLocalizedString(client.getPolicyUri())}'> <h:outputText
value="#{msgs['common.privacyPolicy']}" />
</a>
</p>
</h:panelGroup>
<h:panelGroup layout="block"
rendered='#{!empty client.getTosUri()}'>
rendered='#{!empty client.getDisplayLocalizedString(client.getTosUri())}'>
<p>
<h:outputText value="#{msgs['common.pleaseReadTheTos']}" />
<a target="_blank" href='#{client.getTosUri()}'> <h:outputText
<a target="_blank" href='#{client.getDisplayLocalizedString(client.getTosUri())}'> <h:outputText
value="#{msgs['common.termsOfService']}" />
</a>
</p>
Expand Down

0 comments on commit 5cdc834

Please sign in to comment.