[cxf-fediz] branch master 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 master 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 master
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git


The following commit(s) were added to refs/heads/master by this push:
     new 090031f  Fixed some NPEs in the Fediz OIDC client registration console.
090031f is described below

commit 090031f0d97cc15cdaffe30932fb450267a363b0
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 6539b4a..6327edf 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));