Author: sergeyb
Date: Wed Dec 5 11:21:20 2012
New Revision: 1417361
URL: http://svn.apache.org/viewvc?rev=1417361&view=rev
Log:
Merged revisions 1417360 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1417360 | sergeyb | 2012-12-05 11:16:00 +0000 (Wed, 05 Dec 2012) | 1 line
[CXF-4675] Introducing SubjectCreator interface for users be able to
customize the user subject creation 'closer' to the data
........
Added:
cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/SubjectCreator.java
- copied unchanged from r1417360,
cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/SubjectCreator.java
Modified:
cxf/branches/2.6.x-fixes/ (props changed)
cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/trunk:r1417360
Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java?rev=1417361&r1=1417360&r2=1417361&view=diff
==============================================================================
---
cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
(original)
+++
cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
Wed Dec 5 11:21:20 2012
@@ -42,6 +42,7 @@ import org.apache.cxf.rs.security.oauth2
import org.apache.cxf.rs.security.oauth2.common.UserSubject;
import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
import
org.apache.cxf.rs.security.oauth2.provider.SessionAuthenticityTokenProvider;
+import org.apache.cxf.rs.security.oauth2.provider.SubjectCreator;
import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
import org.apache.cxf.rs.security.oauth2.utils.OAuthUtils;
import org.apache.cxf.security.SecurityContext;
@@ -55,6 +56,7 @@ public abstract class RedirectionBasedGr
private String supportedGrantType;
private boolean isClientConfidential;
private SessionAuthenticityTokenProvider sessionAuthenticityTokenProvider;
+ private SubjectCreator subjectCreator;
protected RedirectionBasedGrantService(String supportedResponseType,
String supportedGrantType,
@@ -241,8 +243,20 @@ public abstract class RedirectionBasedGr
this.sessionAuthenticityTokenProvider =
sessionAuthenticityTokenProvider;
}
+ public void setSubjectCreator(SubjectCreator creator) {
+ this.subjectCreator = creator;
+ }
+
protected UserSubject createUserSubject(SecurityContext securityContext) {
- UserSubject subject =
getMessageContext().getContent(UserSubject.class);
+ UserSubject subject = null;
+ if (subjectCreator != null) {
+ subject = subjectCreator.createUserSubject(getMessageContext());
+ if (subject != null) {
+ return subject;
+ }
+ }
+
+ subject = getMessageContext().getContent(UserSubject.class);
if (subject != null) {
return subject;
} else {