Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2506C200C32 for ; Thu, 9 Mar 2017 18:46:44 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 23B56160B84; Thu, 9 Mar 2017 17:46:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 45F7F160B5F for ; Thu, 9 Mar 2017 18:46:43 +0100 (CET) Received: (qmail 12606 invoked by uid 500); 9 Mar 2017 17:46:42 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 12590 invoked by uid 99); 9 Mar 2017 17:46:42 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Mar 2017 17:46:42 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 02F98C6602 for ; Thu, 9 Mar 2017 17:46:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.652 X-Spam-Level: X-Spam-Status: No, score=0.652 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id LRYXMnYHtpXk for ; Thu, 9 Mar 2017 17:46:41 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 509F15FBE4 for ; Thu, 9 Mar 2017 17:46:40 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 97718E0959 for ; Thu, 9 Mar 2017 17:46:38 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 021F6243AE for ; Thu, 9 Mar 2017 17:46:38 +0000 (UTC) Date: Thu, 9 Mar 2017 17:46:38 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CXF-7264) NPE on OAuth RO/CC flows using JPA MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 09 Mar 2017 17:46:44 -0000 [ https://issues.apache.org/jira/browse/CXF-7264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15903469#comment-15903469 ] ASF GitHub Bot commented on CXF-7264: ------------------------------------- Github user asfgit closed the pull request at: https://github.com/apache/cxf/pull/242 > NPE on OAuth RO/CC flows using JPA > ---------------------------------- > > Key: CXF-7264 > URL: https://issues.apache.org/jira/browse/CXF-7264 > Project: CXF > Issue Type: Bug > Affects Versions: 3.1.10 > Reporter: gonzalad > > *NPE on RO flow* > I'm using the org.apache.cxf.rs.security.oauth2.grants.code.JPACMTCodeDataProvider oauthProvider. > Whenever I call a RO flow, i.e. like : > curl -v -X POST http://localhost:9080/oidc/oauth2/token -d "grant_type=password&username=alice&password=alice&scope=openid" -u PMEvtbd94ca6oQ:_gSNdEM4ELeZ57h8FuVQpQ > I get : > {code} > idp_1 | javax.persistence.PersistenceException: org.hibernate.WrongClassException: Object with id: null was not of the specified subclass: org.apache.cxf.rs.security.oauth2.common.UserSubject (class of the given object did not match class of persistent copy) > idp_1 | at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) > idp_1 | at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310) > idp_1 | at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1316) > idp_1 | at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:898) > idp_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > idp_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > idp_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > idp_1 | at java.lang.reflect.Method.invoke(Method.java:498) > idp_1 | at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:298) > idp_1 | at com.sun.proxy.$Proxy73.merge(Unknown Source) > idp_1 | at org.apache.cxf.rs.security.oauth2.provider.JPAOAuthDataProvider$12.execute(JPAOAuthDataProvider.java:270) > idp_1 | at org.apache.cxf.rs.security.oauth2.provider.JPAOAuthDataProvider$12.execute(JPAOAuthDataProvider.java:251) > idp_1 | at org.apache.cxf.rs.security.oauth2.provider.JPAOAuthDataProvider.executeInTransaction(JPAOAuthDataProvider.java:88) > idp_1 | at org.apache.cxf.rs.security.oauth2.provider.JPAOAuthDataProvider.saveAccessToken(JPAOAuthDataProvider.java:251) > idp_1 | at org.apache.cxf.rs.security.oauth2.provider.AbstractOAuthDataProvider.createAccessToken(AbstractOAuthDataProvider.java:64) > idp_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > idp_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > idp_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > idp_1 | at java.lang.reflect.Method.invoke(Method.java:498) > idp_1 | at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) > idp_1 | at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) > idp_1 | at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) > idp_1 | at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) > idp_1 | at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) > idp_1 | at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) > idp_1 | at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) > idp_1 | at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) > idp_1 | at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) > idp_1 | at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) > idp_1 | at com.sun.proxy.$Proxy74.createAccessToken(Unknown Source) > {code} > This comes from LOC : > sub1 = (UserSubject)em.merge(serverToken.getSubject()); > It returns serverToken.getSubject() and the subject in db are of different types and merge fails : > serverToken.getSubject() > class org.apache.cxf.rs.security.oauth2.common.UserSubject > em.find(UserSubject.class, serverToken.getSubject().getId()) > class org.apache.cxf.rs.security.oidc.idp.OidcUserSubject > *NPE on CC flow* > Whenever I use a Client Credentials flow, i.e. like : > curl -u PMEvtbd94ca6oQ:_gSNdEM4ELeZ57h8FuVQpQ http://localhost:9080/oidc/oauth2/token -d 'grant_type=client_credentials' > I get a NPE in JPAOAuthDataProvider#saveAccessToken, because serverToken.getSubject() is null when using CC flow. -- This message was sent by Atlassian JIRA (v6.3.15#6346)