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 2015/12/04 15:35:21 UTC
cxf git commit: Moving Permission functionality into OAuthPermission
Repository: cxf
Updated Branches:
refs/heads/master 9f8ff0cc0 -> f94e1dd9b
Moving Permission functionality into OAuthPermission
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f94e1dd9
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f94e1dd9
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f94e1dd9
Branch: refs/heads/master
Commit: f94e1dd9b2a8d27ec5a27bfb7c026e3ae2350e39
Parents: 9f8ff0c
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Dec 4 14:35:00 2015 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Dec 4 14:35:00 2015 +0000
----------------------------------------------------------------------
.../oauth2/common/OAuthAuthorizationData.java | 10 +-
.../security/oauth2/common/OAuthPermission.java | 73 ++++++++++++-
.../rs/security/oauth2/common/Permission.java | 106 -------------------
3 files changed, 76 insertions(+), 113 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/f94e1dd9/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java
index 05dc72c..d71b228 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java
@@ -48,7 +48,7 @@ public class OAuthAuthorizationData extends OAuthRedirectionState implements Ser
private Map<String, String> extraApplicationProperties = new HashMap<String, String>();
private boolean implicitFlow;
- private List<? extends Permission> permissions;
+ private List<? extends OAuthPermission> permissions;
public OAuthAuthorizationData() {
}
@@ -74,15 +74,15 @@ public class OAuthAuthorizationData extends OAuthRedirectionState implements Ser
* requested by the client application
* @return the list of scopes
*/
- public List<? extends Permission> getPermissions() {
+ public List<? extends OAuthPermission> getPermissions() {
return permissions;
}
/**
- * Gets the list of scopes translated to {@link Permission} instances
- * @return the list of scopses
+ * Gets the list of scopes translated to {@link OAuthPermission} instances
+ * @return the list of scopes
**/
- public void setPermissions(List<? extends Permission> permissions) {
+ public void setPermissions(List<? extends OAuthPermission> permissions) {
this.permissions = permissions;
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/f94e1dd9/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthPermission.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthPermission.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthPermission.java
index 0aaf300..1be8106 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthPermission.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthPermission.java
@@ -18,6 +18,7 @@
*/
package org.apache.cxf.rs.security.oauth2.common;
+import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
@@ -31,17 +32,22 @@ import javax.xml.bind.annotation.XmlRootElement;
* a limited set of HTTP verbs and request URIs
*/
@XmlRootElement
-public class OAuthPermission extends Permission {
+public class OAuthPermission implements Serializable {
private static final long serialVersionUID = -6486616235830491290L;
private List<String> httpVerbs = new LinkedList<String>();
private List<String> uris = new LinkedList<String>();
+ private String permission;
+ private String description;
+ private boolean isDefault;
+ private boolean invisibleToClient;
public OAuthPermission() {
}
public OAuthPermission(String permission, String description) {
- super(permission, description);
+ this.description = description;
+ this.permission = permission;
}
/**
@@ -77,4 +83,67 @@ public class OAuthPermission extends Permission {
return uris;
}
+ /**
+ * Gets the permission description
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the permission description
+ * @param description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Get the permission value such as "read_calendar"
+ * @return the value
+ */
+ public String getPermission() {
+ return permission;
+ }
+
+ /**
+ * Sets the permission value such as "read_calendar"
+ * @param permission the permission value
+ */
+ public void setPermission(String permission) {
+ this.permission = permission;
+ }
+
+ /**
+ * Indicates if this permission has been allocated by default or not.
+ * Authorization View handlers may use this property to optimize the way the user selects the
+ * scopes.
+ * For example, assume that read', 'add' and 'update' scopes are supported and the
+ * 'read' scope is always allocated. This can be presented at the UI level as follows:
+ * the read-only check-box control will represent a 'read' scope and a user will be able to
+ * optionally select 'add' and/or 'update' scopes, in addition to the default 'read' one.
+ * @param isDefault true if the permission has been allocated by default
+ */
+ public void setDefault(boolean value) {
+ this.isDefault = value;
+ }
+
+ public boolean isDefault() {
+ return isDefault;
+ }
+
+ public boolean isInvisibleToClient() {
+ return invisibleToClient;
+ }
+
+ /**
+ * Set the visibility status; by default all the scopes approved by a user can
+ * be optionally reported to the client in access token responses. Some scopes may need
+ * to stay 'invisible' to client.
+ * @param invisibleToClient
+ */
+ public void setInvisibleToClient(boolean invisibleToClient) {
+ this.invisibleToClient = invisibleToClient;
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/f94e1dd9/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Permission.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Permission.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Permission.java
deleted file mode 100644
index f6d4d29..0000000
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Permission.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.rs.security.oauth2.common;
-
-import java.io.Serializable;
-
-/**
- * Base permission description
- * @see OAuthAuthorizationData
- */
-public class Permission implements Serializable {
- private static final long serialVersionUID = 8988574955042726083L;
- private String permission;
- private String description;
- private boolean isDefault;
- private boolean invisibleToClient;
-
- public Permission() {
-
- }
-
- public Permission(String permission, String description) {
- this.description = description;
- this.permission = permission;
- }
-
- /**
- * Gets the permission description
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the permission description
- * @param description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Get the permission value such as "read_calendar"
- * @return the value
- */
- public String getPermission() {
- return permission;
- }
-
- /**
- * Sets the permission value such as "read_calendar"
- * @param permission the permission value
- */
- public void setPermission(String permission) {
- this.permission = permission;
- }
-
- /**
- * Indicates if this permission has been allocated by default or not.
- * Authorization View handlers may use this property to optimize the way the user selects the
- * scopes.
- * For example, assume that read', 'add' and 'update' scopes are supported and the
- * 'read' scope is always allocated. This can be presented at the UI level as follows:
- * the read-only check-box control will represent a 'read' scope and a user will be able to
- * optionally select 'add' and/or 'update' scopes, in addition to the default 'read' one.
- * @param isDefault true if the permission has been allocated by default
- */
- public void setDefault(boolean value) {
- this.isDefault = value;
- }
-
- public boolean isDefault() {
- return isDefault;
- }
-
- public boolean isInvisibleToClient() {
- return invisibleToClient;
- }
-
- /**
- * Set the visibility status; by default all the scopes approved by a user can
- * be optionally reported to the client in access token responses. Some scopes may need
- * to stay 'invisible' to client.
- * @param invisibleToClient
- */
- public void setInvisibleToClient(boolean invisibleToClient) {
- this.invisibleToClient = invisibleToClient;
- }
-}