You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2013/08/26 13:42:01 UTC
svn commit: r1517504 - in /cxf/branches/2.7.x-fixes: ./
rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/
rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/
Author: sergeyb
Date: Mon Aug 26 11:42:00 2013
New Revision: 1517504
URL: http://svn.apache.org/r1517504
Log:
Merged revisions 1517500 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1517500 | sergeyb | 2013-08-26 12:35:58 +0100 (Mon, 26 Aug 2013) | 1 line
[CXF-5179] adding an optional id property to OAuth user subject, applying a patch on behalf of Thorsten Hoeger
........
Modified:
cxf/branches/2.7.x-fixes/ (props changed)
cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/UserSubject.java
cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthContextUtils.java
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/trunk:r1517500
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/UserSubject.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/UserSubject.java?rev=1517504&r1=1517503&r2=1517504&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/UserSubject.java (original)
+++ cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/UserSubject.java Mon Aug 26 11:42:00 2013
@@ -31,6 +31,7 @@ import javax.xml.bind.annotation.XmlRoot
public class UserSubject {
private String login;
+ private String id;
private List<String> roles = new LinkedList<String>();
private List<Property> properties = new LinkedList<Property>();
@@ -47,6 +48,17 @@ public class UserSubject {
this.roles = roles;
}
+ public UserSubject(String login, String id) {
+ this.login = login;
+ this.id = id;
+ }
+
+ public UserSubject(String login, String id, List<String> roles) {
+ this.login = login;
+ this.id = id;
+ this.roles = roles;
+ }
+
/**
* Return the user login name
* @return the login name
@@ -97,5 +109,20 @@ public class UserSubject {
this.properties = properties;
}
-
+ /**
+ * Get the user's unique id
+ * @return the user's id
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * Set the users unique id
+ * @param id the user's id
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
}
Modified: cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthContextUtils.java?rev=1517504&r1=1517503&r2=1517504&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthContextUtils.java (original)
+++ cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthContextUtils.java Mon Aug 26 11:42:00 2013
@@ -35,6 +35,16 @@ public final class OAuthContextUtils {
/**
* @param mc the {@link MessageContext}
+ * @return the id of the UserSubject of the logged in user or resource owner
+ * @throws WebApplicationException with Status 401 if not authenticated
+ */
+ public static String resolveUserId(final MessageContext mc) {
+ final OAuthContext oauth = getContext(mc);
+ return oauth.getSubject().getId();
+ }
+
+ /**
+ * @param mc the {@link MessageContext}
* @return the name of the UserSubject of the logged in user or resource owner
* @throws WebApplicationException with Status 401 if not authenticated
*/