Skip to content

Commit

Permalink
fix(jans-auth-server): fix language metadata format (#2883)
Browse files Browse the repository at this point in the history
* fix(jans-auth-server): fix language metadata format

* fix(jans-auth-server): fix language metadata format
  • Loading branch information
qbert2k authored Nov 7, 2022
1 parent 1f9c2e4 commit e21e206
Show file tree
Hide file tree
Showing 8 changed files with 365 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,6 @@ public void authorizationCodeFlow(
.claimsPresence(JwtClaimName.PHONE_NUMBER_VERIFIED, JwtClaimName.ADDRESS, JwtClaimName.USER_NAME)
.claimsNoPresence("org_name", "work_phone")
.check();

// 7. Request client info
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint);
ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);

showClient(clientInfoClient);
AssertBuilder.clientInfoResponse(clientInfoResponse)
.notNullClientInfoClaims()
.claimsPresence(CLIENT_INFO_NAME_CLAIMS)
.check();
}

@Parameters({"userId", "userSecret", "redirectUri", "redirectUris", "clientJwksUri",
Expand Down Expand Up @@ -223,16 +213,6 @@ public void requestParameterMethodRS256(
.notNullClaimsPersonalData()
.claimsPresence(JwtClaimName.EMAIL)
.check();

// 5. Request client info
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint);
ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);

showClient(clientInfoClient);
AssertBuilder.clientInfoResponse(clientInfoResponse)
.notNullClientInfoClaims()
.claimsPresence(CLIENT_INFO_NAME_CLAIMS)
.check();
}

private RegisterResponse getRegisterResponse(String redirectUris, String sectorIdentifierUri, List<ResponseType> responseTypes, List<String> scopes, String clientJwksUri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

/**
* @author Javier Rojas Blum
* @version June 30, 2022
* @version October 17, 2022
*/
@DataEntry(sortBy = {"displayName"})
@ObjectClass(value = "jansClnt")
Expand Down Expand Up @@ -79,29 +79,44 @@ public class Client extends DeletableEntity implements Serializable {
private String idTokenTokenBindingCnf;

@AttributeName(name = "displayName")
private String clientName;

@AttributeName(name = "jansLogoURI")
private String logoUri;

@AttributeName(name = "jansClntURI")
private String clientUri;

@AttributeName(name = "jansPolicyURI")
private String policyUri;

@AttributeName(name = "jansTosURI")
private String tosUri;

@AttributeName(name = "displayNameLocalized")
@JsonObject
@LanguageTag
private LocalizedString clientName = new LocalizedString();
private LocalizedString clientNameLocalized = new LocalizedString();

@AttributeName(name = "jansLogoURI")
@AttributeName(name = "jansLogoURILocalized")
@JsonObject
@LanguageTag
private LocalizedString logoUri = new LocalizedString();
private LocalizedString logoUriLocalized = new LocalizedString();

@AttributeName(name = "jansClntURI")
@AttributeName(name = "jansClntURILocalized")
@JsonObject
@LanguageTag
private LocalizedString clientUri = new LocalizedString();
private LocalizedString clientUriLocalized = new LocalizedString();

@AttributeName(name = "jansPolicyURI")
@AttributeName(name = "jansPolicyURILocalized")
@JsonObject
@LanguageTag
private LocalizedString policyUri = new LocalizedString();
private LocalizedString policyUriLocalized = new LocalizedString();

@AttributeName(name = "jansTosURI")
@AttributeName(name = "jansTosURILocalized")
@JsonObject
@LanguageTag
private LocalizedString tosUri = new LocalizedString();
private LocalizedString tosUriLocalized = new LocalizedString();

@AttributeName(name = "jansJwksURI")
private String jwksUri;
Expand Down Expand Up @@ -590,11 +605,11 @@ public boolean isTokenBindingSupported() {
}

/**
* Returns the name of the Client to be presented to the user represented in a language and a script.
* Returns the name of the Client to be presented to the user.
*
* @return The name of the Client to be presented to the user.
*/
public LocalizedString getClientName() {
public String getClientName() {
return clientName;
}

Expand All @@ -604,7 +619,102 @@ public LocalizedString getClientName() {
* @param clientName The name of the Client to be presented to the user.
*/
public void setClientName(String clientName) {
this.clientName.setValue(clientName);
this.clientName = clientName;
}

/**
* Returns a URL that references a logo for the Client application.
*
* @return The URL of a logo image for the Client where it can be retrieved.
*/
public String getLogoUri() {
return logoUri;
}

/**
* Sets a URL that references a logo for the Client application.
*
* @param logoUri The URL of a logo image for the Client where it can be retrieved.
*/
public void setLogoUri(String logoUri) {
this.logoUri = logoUri;
}

/**
* Returns a URL of the home page of the Client.
*
* @return The URL of the home page of the Client.
*/
public String getClientUri() {
return clientUri;
}

/**
* Sets a URL of the home page of the Client.
*
* @param clientUri The URL of the home page of the Client.
*/
public void setClientUri(String clientUri) {
this.clientUri = clientUri;
}

/**
* Returns a URL that the Relying Party Client provides to the End-User to read about how the profile data will
* be used.
*
* @return A URL location about how the profile data will be used.
*/
public String getPolicyUri() {
return policyUri;
}

/**
* Sets a URL that the Relying Party Client provides to the End-User to read about how the profile data will
* be used.
*
* @param policyUri A URL location about how the profile data will be used.
*/
public void setPolicyUri(String policyUri) {
this.policyUri = policyUri;
}

/**
* Returns a URL that the Relying Party Client provides to the End-User to read about the Relying Party's terms
* of service.
*
* @return The terms of service URL.
*/
public String getTosUri() {
return tosUri;
}

/**
* Sets a URL that the Relying Party Client provides to the End-User to read about the Relying Party's terms of
* service.
*
* @param tosUri The terms of service URL.
*/
public void setTosUri(String tosUri) {
this.tosUri = tosUri;
}

/**
* Returns the name of the Client to be presented to the user represented in a language and a script.
*
* @return The name of the Client to be presented to the user.
*/
public LocalizedString getClientNameLocalized() {
return clientNameLocalized;
}

/**
* Sets the name of the Client to be presented to the user.
*
* @param clientName The name of the Client to be presented to the user.
*/
public void setClientNameLocalized(String clientName) {
this.clientName = clientName;
this.clientNameLocalized.setValue(clientName);
}

/**
Expand All @@ -613,26 +723,31 @@ public void setClientName(String clientName) {
* @param clientName The name of the Client to be presented to the user.
* @param locale The locale
*/
public void setClientName(String clientName, Locale locale) {
this.clientName.setValue(clientName, locale);
public void setClientNameLocalized(String clientName, Locale locale) {
if (StringUtils.isNotBlank(locale.toString())) {
this.clientNameLocalized.setValue(clientName, locale);
} else {
setClientNameLocalized(clientName);
}
}

/**
* Returns a URL that references a logo for the Client application represented in a language and a script.
*
* @return The URL of a logo image for the Client where it can be retrieved.
*/
public LocalizedString getLogoUri() {
return logoUri;
public LocalizedString getLogoUriLocalized() {
return logoUriLocalized;
}

/**
* Sets a URL that references a logo for the Client application.
*
* @param logoUri The URL of a logo image for the Client where it can be retrieved.
*/
public void setLogoUri(String logoUri) {
this.logoUri.setValue(logoUri);
public void setLogoUriLocalized(String logoUri) {
this.logoUri = logoUri;
this.logoUriLocalized.setValue(logoUri);
}

/**
Expand All @@ -641,26 +756,31 @@ public void setLogoUri(String logoUri) {
* @param logoUri The URL of a logo image for the Client where it can be retrieved.
* @param locale The locale
*/
public void setLogoUri(String logoUri, Locale locale) {
this.logoUri.setValue(logoUri, locale);
public void setLogoUriLocalized(String logoUri, Locale locale) {
if (StringUtils.isNotBlank(locale.toString())) {
this.logoUriLocalized.setValue(logoUri, locale);
} else {
setLogoUriLocalized(logoUri);
}
}

/**
* Returns a URL of the home page of the Client represented in a language and script
*
* @return The URL of the home page of the Client.
*/
public LocalizedString getClientUri() {
return clientUri;
public LocalizedString getClientUriLocalized() {
return clientUriLocalized;
}

/**
* Sets a URL of the home page of the Client.
*
* @param clientUri The URL of the home page of the Client.
*/
public void setClientUri(String clientUri) {
this.clientUri.setValue(clientUri);
public void setClientUriLocalized(String clientUri) {
this.clientUri = clientUri;
this.clientUriLocalized.setValue(clientUri);
}

/**
Expand All @@ -669,8 +789,12 @@ public void setClientUri(String clientUri) {
* @param clientUri The URL of the home page of the Client.
* @param locale The locale
*/
public void setClientUri(String clientUri, Locale locale) {
this.clientUri.setValue(clientUri, locale);
public void setClientUriLocalized(String clientUri, Locale locale) {
if (StringUtils.isNotBlank(locale.toString())) {
this.clientUriLocalized.setValue(clientUri, locale);
} else {
setClientUriLocalized(clientUri);
}
}

/**
Expand All @@ -679,8 +803,8 @@ public void setClientUri(String clientUri, Locale locale) {
*
* @return A URL location about how the profile data will be used.
*/
public LocalizedString getPolicyUri() {
return policyUri;
public LocalizedString getPolicyUriLocalized() {
return policyUriLocalized;
}

/**
Expand All @@ -689,8 +813,9 @@ public LocalizedString getPolicyUri() {
*
* @param policyUri A URL location about how the profile data will be used.
*/
public void setPolicyUri(String policyUri) {
this.policyUri.setValue(policyUri);
public void setPolicyUriLocalized(String policyUri) {
this.policyUri = policyUri;
this.policyUriLocalized.setValue(policyUri);
}

/**
Expand All @@ -700,8 +825,12 @@ public void setPolicyUri(String policyUri) {
* @param policyUri A URL location about how the profile data will be used.
* @param locale The locale
*/
public void setPolicyUri(String policyUri, Locale locale) {
this.policyUri.setValue(policyUri, locale);
public void setPolicyUriLocalized(String policyUri, Locale locale) {
if (StringUtils.isNotBlank(locale.toString())) {
this.policyUriLocalized.setValue(policyUri, locale);
} else {
setPolicyUriLocalized(policyUri);
}
}

/**
Expand All @@ -710,8 +839,8 @@ public void setPolicyUri(String policyUri, Locale locale) {
*
* @return The terms of service URL.
*/
public LocalizedString getTosUri() {
return tosUri;
public LocalizedString getTosUriLocalized() {
return tosUriLocalized;
}

/**
Expand All @@ -720,8 +849,9 @@ public LocalizedString getTosUri() {
*
* @param tosUri The terms of service URL.
*/
public void setTosUri(String tosUri) {
this.tosUri.setValue(tosUri);
public void setTosUriLocalized(String tosUri) {
this.tosUri = tosUri;
this.tosUriLocalized.setValue(tosUri);
}

/**
Expand All @@ -731,8 +861,12 @@ public void setTosUri(String tosUri) {
* @param tosUri The terms of service URL.
* @param locale The Locale
*/
public void setTosUri(String tosUri, Locale locale) {
this.tosUri.setValue(tosUri, locale);
public void setTosUriLocalized(String tosUri, Locale locale) {
if (StringUtils.isNotBlank(locale.toString())) {
this.tosUriLocalized.setValue(tosUri, locale);
} else {
setTosUriLocalized(tosUri);
}
}

/**
Expand Down Expand Up @@ -1288,7 +1422,7 @@ public void setBackchannelUserCodeParameter(Boolean backchannelUserCodeParameter
}

public String getDisplayName() {
return getClientName().getValue();
return getClientName();
}

public void setDisplayName(String displayName) {
Expand Down
Loading

0 comments on commit e21e206

Please sign in to comment.