github-advanced-security[bot] commented on code in PR #1252:
URL: https://github.com/apache/syncope/pull/1252#discussion_r2581886613


##########
client/am/console/src/main/java/org/apache/syncope/client/console/panels/OIDCJWKSGenerationPanel.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.panels;
+
+import java.util.List;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.client.console.rest.OIDCJWKSRestClient;
+import org.apache.syncope.client.console.rest.WAConfigRestClient;
+import 
org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxEventBehavior;
+import 
org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.syncope.client.ui.commons.Constants;
+import 
org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel;
+import 
org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel;
+import 
org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.OIDCJWKSTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.model.Model;
+
+public class OIDCJWKSGenerationPanel extends AbstractModalPanel<OIDCJWKSTO> {
+
+    private static final long serialVersionUID = -3372006007594607067L;
+
+    protected final OIDCJWKSRestClient oidcJWKSRestClient;
+
+    protected final Model<String> jwksKeyIdM;
+
+    protected final Model<String> jwksTypeM;
+
+    protected final Model<Integer> jwksKeySizeM;
+
+    public OIDCJWKSGenerationPanel(
+            final OIDCJWKSRestClient oidcJWKSRestClient,
+            final WAConfigRestClient waConfigRestClient,
+            final BaseModal<OIDCJWKSTO> modal,
+            final PageReference pageRef) {
+
+        super(modal, pageRef);
+        this.oidcJWKSRestClient = oidcJWKSRestClient;
+
+        jwksKeyIdM = Model.of("syncope");
+        try {
+            
jwksKeyIdM.setObject(waConfigRestClient.get("cas.authn.oidc.jwks.core.jwks-key-id").getValues().getFirst());
+        } catch (SyncopeClientException e) {
+            LOG.error("While reading cas.authn.oidc.jwks.core.jwks-key-id", e);
+        }
+        add(new AjaxTextFieldPanel("jwksKeyId", "jwksKeyId", 
jwksKeyIdM).setRequired(true));
+
+        jwksTypeM = Model.of("rsa");
+        try {
+            
jwksTypeM.setObject(waConfigRestClient.get("cas.authn.oidc.jwks.core.jwks-type").getValues().getFirst());
+        } catch (SyncopeClientException e) {
+            LOG.error("While reading cas.authn.oidc.jwks.core.jwks-type", e);
+        }
+        AjaxDropDownChoicePanel<String> jwksType = new 
AjaxDropDownChoicePanel<>("jwksType", "jwksType", jwksTypeM).
+                setChoices(List.of("rsa", "ec"));
+        add(jwksType.setRequired(true));
+
+        jwksKeySizeM = Model.of(2048);
+        try {
+            jwksKeySizeM.setObject(Integer.valueOf(
+                    
waConfigRestClient.get("cas.authn.oidc.jwks.core.jwks-key-size").getValues().getFirst()));

Review Comment:
   ## Missing catch of NumberFormatException
   
   Potential uncaught 'java.lang.NumberFormatException'.
   
   [Show more 
details](https://github.com/apache/syncope/security/code-scanning/2363)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to