You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/07/20 14:05:02 UTC

[cxf] 01/02: Fixed potential NPE in SAML OAuth 2.0 code

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

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

commit af9de729e3745214be191a732bef41d28c5ac7e9
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Fri Jul 20 12:30:21 2018 +0100

    Fixed potential NPE in SAML OAuth 2.0 code
    
    (cherry picked from commit dd2ad753ca0980a3f83347016adff97aee5c09c2)
    (cherry picked from commit 963b17be320f5206280c18075cfe7ebd1b41e9df)
    
    # Conflicts:
    #	rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/Saml2BearerGrantHandler.java
---
 .../cxf/rs/security/oauth2/grants/saml/Saml2BearerGrantHandler.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/Saml2BearerGrantHandler.java b/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/Saml2BearerGrantHandler.java
index 9fecf1c..6fbd3c1 100644
--- a/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/Saml2BearerGrantHandler.java
+++ b/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/Saml2BearerGrantHandler.java
@@ -138,7 +138,7 @@ public class Saml2BearerGrantHandler extends AbstractGrantHandler {
             SAMLSecurityContext jaxrsSc = (SAMLSecurityContext)sc;
             Set<Principal> rolesP = jaxrsSc.getUserRoles();
             List<String> roles = new ArrayList<String>();
-            if (roles != null) {
+            if (rolesP != null) {
                 for (Principal p : rolesP) {
                     roles.add(p.getName());
                 }