[cxf-fediz] branch 1.4.x-fixes updated: Fixed some NPEs in the Fediz OIDC client registration console.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[cxf-fediz] branch 1.4.x-fixes updated: Fixed some NPEs in the Fediz OIDC client registration console.

coheigea
Administrator
This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch 1.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git


The following commit(s) were added to refs/heads/1.4.x-fixes by this push:
     new 0d3a26c  Fixed some NPEs in the Fediz OIDC client registration console.
0d3a26c is described below

commit 0d3a26c8d9af2b77af33a2757bf90ad61f448e50
Author: Colm O hEigeartaigh <[hidden email]>
AuthorDate: Mon Feb 11 16:03:22 2019 +0000

    Fixed some NPEs in the Fediz OIDC client registration console.
---
 .../service/oidc/clients/ClientRegistrationService.java      | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
index 7cdd9a8..543d3a9 100644
--- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
+++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
@@ -160,6 +160,9 @@ public class ClientRegistrationService {
         checkSecurityContext();
 
         Client c = getRegisteredClient(id);
+        if (c == null) {
+            throwInvalidRegistrationException("The client id is invalid");
+        }
         if (c.isConfidential()) {
             c.setClientSecret(generateClientSecret());
         }
@@ -173,6 +176,9 @@ public class ClientRegistrationService {
     public ClientTokens getClientIssuedTokens(@PathParam("id") String id) {
         checkSecurityContext();
         Client c = getRegisteredClient(id);
+        if (c == null) {
+            throwInvalidRegistrationException("The client id is invalid");
+        }
         return doGetClientIssuedTokens(c);
     }
 
@@ -217,6 +223,9 @@ public class ClientRegistrationService {
         checkSecurityContext();
 
         Client c = getRegisteredClient(clientId);
+        if (c == null) {
+            throwInvalidRegistrationException("The client id is invalid");
+        }
         dataProvider.revokeToken(c, tokenId, tokenType);
         return doGetClientIssuedTokens(c);
     }
@@ -228,6 +237,9 @@ public class ClientRegistrationService {
         checkSecurityContext();
         if (dataProvider instanceof AuthorizationCodeDataProvider) {
             Client c = getRegisteredClient(id);
+            if (c == null) {
+                throwInvalidRegistrationException("The client id is invalid");
+            }
             UserSubject subject = new OidcUserSubject(getUserName());
             List<ServerAuthorizationCodeGrant> codeGrants = new ArrayList<>(
                ((AuthorizationCodeDataProvider)dataProvider).getCodeGrants(c, subject));