112 if (Strings.isNullOrEmpty(
params.getOpHost())) {
113 LOG.warn(
"'op_host' is not set for parameter: " +
params +
". Look up at configuration file for fallback of 'op_host'");
114 String fallbackOpHost = fallback.getOpHost();
115 if (Strings.isNullOrEmpty(fallbackOpHost)) {
116 throw new ErrorResponseException(ErrorResponseCode.INVALID_OP_HOST);
118 LOG.warn(
"Fallback to op_host: " + fallbackOpHost +
", from configuration file.");
119 params.setOpHost(fallbackOpHost);
123 List<String> grantTypes = Lists.newArrayList();
125 if (
params.getGrantType() != null && !
params.getGrantType().isEmpty()) {
126 grantTypes.addAll(
params.getGrantType());
129 if (grantTypes.isEmpty() && fallback.getGrantType() != null && !fallback.getGrantType().isEmpty()) {
130 grantTypes.addAll(fallback.getGrantType());
133 if (grantTypes.isEmpty()) {
134 grantTypes.add(GrantType.AUTHORIZATION_CODE.getValue());
137 params.setGrantType(grantTypes);
140 if (Strings.isNullOrEmpty(
params.getAuthorizationRedirectUri())) {
141 params.setAuthorizationRedirectUri(fallback.getAuthorizationRedirectUri());
143 if (!Utils.isValidUrl(
params.getAuthorizationRedirectUri())) {
144 throw new ErrorResponseException(ErrorResponseCode.INVALID_AUTHORIZATION_REDIRECT_URI);
148 if (Strings.isNullOrEmpty(
params.getPost_logout_redirect_uri()) && !Strings.isNullOrEmpty(fallback.getPostLogoutRedirectUri())) {
149 params.setPost_logout_redirect_uri(fallback.getPostLogoutRedirectUri());
153 List<String> responseTypes = Lists.newArrayList();
154 if (
params.getResponseTypes() != null && !
params.getResponseTypes().isEmpty()) {
155 responseTypes.addAll(
params.getResponseTypes());
157 if (responseTypes.isEmpty() && fallback.getResponseTypes() != null && !fallback.getResponseTypes().isEmpty()) {
158 responseTypes.addAll(fallback.getResponseTypes());
160 if (responseTypes.isEmpty()) {
161 responseTypes.add(
"code");
163 params.setResponseTypes(responseTypes);
166 Set<String> redirectUris = Sets.newHashSet();
167 redirectUris.add(
params.getAuthorizationRedirectUri());
168 if (
params.getRedirectUris() != null && !
params.getRedirectUris().isEmpty()) {
169 redirectUris.addAll(
params.getRedirectUris());
170 if (!Strings.isNullOrEmpty(
params.getPost_logout_redirect_uri())) {
171 redirectUris.add(
params.getPost_logout_redirect_uri());
175 if (autoRegister != null && autoRegister && !redirectUris.isEmpty()) {
176 String first = redirectUris.iterator().next();
177 if (first.contains(
params.getOpHost())) {
179 String autoRedirectUri = discovery.getClaimsInteractionEndpoint() +
"?authentication=true";
181 LOG.trace(
"Register claims interaction endpoint as redirect_uri: " + autoRedirectUri);
182 redirectUris.add(autoRedirectUri);
184 LOG.trace(
"Skip auto registration of claims interaction endpoint as redirect_uri because OP host for different uri's is different which will not pass AS redirect_uri's validation (same host must be present).");
187 params.setRedirectUris(Lists.newArrayList(redirectUris));
190 Set<String> claimsRedirectUris = Sets.newHashSet();
191 if (
params.getClaimsRedirectUri() != null && !
params.getClaimsRedirectUri().isEmpty()) {
192 claimsRedirectUris.addAll(
params.getClaimsRedirectUri());
194 params.setClaimsRedirectUri(Lists.newArrayList(claimsRedirectUris));
197 if (
params.getScope() == null ||
params.getScope().isEmpty()) {
198 params.setScope(fallback.getScope());
200 if (
params.getScope() == null ||
params.getScope().isEmpty()) {
201 throw new ErrorResponseException(ErrorResponseCode.INVALID_SCOPE);
205 if (
params.getAcrValues() == null ||
params.getAcrValues().isEmpty()) {
206 params.setAcrValues(fallback.getAcrValues());
210 if (Strings.isNullOrEmpty(
params.getClientJwksUri()) && !Strings.isNullOrEmpty(fallback.getClientJwksUri())) {
211 params.setClientJwksUri(fallback.getClientJwksUri());
215 if (
params.getContacts() == null ||
params.getContacts().isEmpty()) {
216 params.setContacts(fallback.getContacts());
220 if (
params.getUiLocales() == null ||
params.getUiLocales().isEmpty()) {
221 params.setUiLocales(fallback.getUiLocales());
225 if (
params.getClaimsLocales() == null ||
params.getClaimsLocales().isEmpty()) {
226 params.setClaimsLocales(fallback.getClaimsLocales());
static final Logger LOG
Definition: RegisterSiteOperation.java:45
ConfigurationService getConfigurationService()
Definition: BaseOperation.java:108
DiscoveryService getDiscoveryService()
Definition: BaseOperation.java:96
Rp defaultRp()
Definition: ConfigurationService.java:40
final T params
Definition: BaseOperation.java:40
Boolean getUma2AuthRegisterClaimsGatheringEndpointAsRedirectUriOfClient()
Definition: OxdServerConfiguration.java:118
OxdServerConfiguration getConfiguration()
Definition: ConfigurationService.java:49