]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/OsAuthenticationProvider.java
Add dep folder
[lgpl/argeo-commons.git] / security / runtime / org.argeo.security.core / src / main / java / org / argeo / security / core / OsAuthenticationProvider.java
index 33a4f6376326bf37571e18220e97e515ba446020..0e29ecd59a75e6fbfe0f422acce415508da73f4b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2012 Mathieu Baudier
+ * Copyright (C) 2007-2012 Argeo GmbH
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,21 +29,22 @@ import org.springframework.security.providers.AuthenticationProvider;
  * Validates an OS authentication. The id is that it will always be
  * authenticated since we are always runnign within an OS, but the fact that the
  * {@link Authentication} works properly depends on the proper OS login module
- * having been called as well.
+ * having been called as well. TODO make it more configurable (base roles, is
+ * admin)
  */
 public class OsAuthenticationProvider implements AuthenticationProvider {
-       private String osUserRole = "ROLE_OS_USER";
-       private String userRole = "ROLE_USER";
-       private String adminRole = "ROLE_ADMIN";
+       final static String osUserRole = "ROLE_OS_USER";
+       final static String userRole = "ROLE_USER";
+       final static String adminRole = "ROLE_ADMIN";
 
-       private Boolean isAdmin = true;
+       final static Boolean isAdmin = true;
 
        public Authentication authenticate(Authentication authentication)
                        throws AuthenticationException {
                return new OsAuthenticationToken(getBaseAuthorities());
        }
 
-       protected GrantedAuthority[] getBaseAuthorities() {
+       public static GrantedAuthority[] getBaseAuthorities() {
                List<GrantedAuthority> auths = new ArrayList<GrantedAuthority>();
                auths.add(new GrantedAuthorityImpl(osUserRole));
                auths.add(new GrantedAuthorityImpl(userRole));
@@ -57,20 +58,4 @@ public class OsAuthenticationProvider implements AuthenticationProvider {
                return OsAuthenticationToken.class.isAssignableFrom(authentication);
        }
 
-       public void setOsUserRole(String osUserRole) {
-               this.osUserRole = osUserRole;
-       }
-
-       public void setUserRole(String userRole) {
-               this.userRole = userRole;
-       }
-
-       public void setAdminRole(String adminRole) {
-               this.adminRole = adminRole;
-       }
-
-       public void setIsAdmin(Boolean isAdmin) {
-               this.isAdmin = isAdmin;
-       }
-
 }