You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2014/08/20 17:30:37 UTC

[36/50] [abbrv] git commit: AMBARI-6933. Rolling restart not working.

AMBARI-6933. Rolling restart not working.


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f72b323f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f72b323f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f72b323f

Branch: refs/heads/branch-alerts-dev
Commit: f72b323f7e468da16067607221a08d9d0926bf30
Parents: 068cafa
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Tue Aug 19 22:46:34 2014 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Tue Aug 19 22:46:34 2014 -0700

----------------------------------------------------------------------
 .../internal/InternalAuthenticationToken.java      | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f72b323f/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java
index 1fc86a2..8752278 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java
@@ -17,26 +17,37 @@
  */
 
 package org.apache.ambari.server.security.authorization.internal;
+
+import org.apache.ambari.server.orm.entities.PermissionEntity;
+import org.apache.ambari.server.orm.entities.PrivilegeEntity;
+import org.apache.ambari.server.security.authorization.AmbariGrantedAuthority;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
 import org.springframework.security.core.userdetails.User;
-
 import java.util.Collection;
 import java.util.Collections;
 
 public class InternalAuthenticationToken implements Authentication {
 
   private static final String INTERNAL_NAME = "internal";
+  private static final PrivilegeEntity ADMIN_PRIV_ENTITY = new PrivilegeEntity();
 
   // used in ClustersImpl, checkPermissions
   private static final Collection<? extends GrantedAuthority> AUTHORITIES =
-      Collections.singleton(new SimpleGrantedAuthority("AMBARI.ADMIN"));
+    Collections.singleton(new AmbariGrantedAuthority(ADMIN_PRIV_ENTITY));
   private static final User INTERNAL_USER = new User(INTERNAL_NAME, "empty", AUTHORITIES);
 
   private String token;
   private boolean authenticated = false;
 
+  static{
+    PermissionEntity pe = new PermissionEntity();
+    pe.setId(PermissionEntity.AMBARI_ADMIN_PERMISSION);
+    pe.setPermissionName(PermissionEntity.AMBARI_ADMIN_PERMISSION_NAME);
+
+    ADMIN_PRIV_ENTITY.setPermission(pe);
+  }
+
   public InternalAuthenticationToken(String tokenString) {
     this.token = tokenString;
   }