]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.security.core/src/org/argeo/security/core/InternalAuthentication.java
Introduce ROLE_USER_ADMIN and ROLE_GROUP_ADMIN
[lgpl/argeo-commons.git] / org.argeo.security.core / src / org / argeo / security / core / InternalAuthentication.java
index 267ddd312af8d0741c1876bbd9a86b388f7195ef..31e29d18d773f6d338559af2397ae7f8990b2f10 100644 (file)
  */
 package org.argeo.security.core;
 
+import java.util.Collections;
+
 import org.argeo.security.SystemAuthentication;
-import org.springframework.security.GrantedAuthority;
-import org.springframework.security.GrantedAuthorityImpl;
-import org.springframework.security.adapters.PrincipalSpringSecurityUserToken;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
 
 /** A token base on a system key used to request a system authentication. */
-public class InternalAuthentication extends PrincipalSpringSecurityUserToken
+public class InternalAuthentication extends UsernamePasswordAuthenticationToken
                implements SystemAuthentication {
        private static final long serialVersionUID = -6783376375615949315L;
-       /** 'admin' for consistency with JCR */
-       public final static String DEFAULT_SYSTEM_USERNAME = "admin";
-       public final static String DEFAULT_SYSTEM_ROLE = "ROLE_SYSTEM";
-       public final static String SYSTEM_KEY_PROPERTY = "argeo.security.systemKey";
        public final static String SYSTEM_KEY_DEFAULT = "argeo";
 
        public InternalAuthentication(String key, String systemUsername,
                        String systemRole) {
-               super(
-                               key,
-                               systemUsername,
-                               key,
-                               new GrantedAuthority[] { new GrantedAuthorityImpl(systemRole) },
-                               systemUsername);
+               super(systemUsername, key, Collections
+                               .singleton(new SimpleGrantedAuthority(systemRole)));
        }
 
        public InternalAuthentication(String key) {
-               this(key, DEFAULT_SYSTEM_USERNAME, DEFAULT_SYSTEM_ROLE);
+               this(key, SystemAuthentication.USERNAME_SYSTEM, SystemAuthentication.ROLE_SYSTEM);
        }
 
 }