Class UserDetailsResourceFactoryBean
- java.lang.Object
-
- org.springframework.security.config.core.userdetails.UserDetailsResourceFactoryBean
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.FactoryBean<java.util.Collection<org.springframework.security.core.userdetails.UserDetails>>,org.springframework.context.ResourceLoaderAware
public class UserDetailsResourceFactoryBean extends java.lang.Object implements org.springframework.context.ResourceLoaderAware, org.springframework.beans.factory.FactoryBean<java.util.Collection<org.springframework.security.core.userdetails.UserDetails>>Parses a Resource that is a Properties file in the format of:username=password[,enabled|disabled],roles...The enabled and disabled properties are optional with enabled being the default. For example:user=password,ROLE_USER admin=secret,ROLE_USER,ROLE_ADMIN disabled_user=does_not_matter,disabled,ROLE_USER- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description UserDetailsResourceFactoryBean()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UserDetailsResourceFactoryBeanfromResource(org.springframework.core.io.Resource propertiesResource)Create a UserDetailsResourceFactoryBean with a Resource that is a Properties file in the format defined inUserDetailsResourceFactoryBean.static UserDetailsResourceFactoryBeanfromResourceLocation(java.lang.String resourceLocation)Create a UserDetailsResourceFactoryBean with the location of a Resource that is a Properties file in the format defined inUserDetailsResourceFactoryBean.static UserDetailsResourceFactoryBeanfromString(java.lang.String users)Creates a UserDetailsResourceFactoryBean with a resource from the provided Stringjava.util.Collection<org.springframework.security.core.userdetails.UserDetails>getObject()java.lang.Class<?>getObjectType()voidsetResource(org.springframework.core.io.Resource resource)Sets a Resource that is a Properties file in the format defined inUserDetailsResourceFactoryBean.voidsetResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)voidsetResourceLocation(java.lang.String resourceLocation)Sets the location of a Resource that is a Properties file in the format defined inUserDetailsResourceFactoryBean.
-
-
-
Method Detail
-
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
- Specified by:
setResourceLoaderin interfaceorg.springframework.context.ResourceLoaderAware
-
getObject
public java.util.Collection<org.springframework.security.core.userdetails.UserDetails> getObject() throws java.lang.Exception- Specified by:
getObjectin interfaceorg.springframework.beans.factory.FactoryBean<java.util.Collection<org.springframework.security.core.userdetails.UserDetails>>- Throws:
java.lang.Exception
-
getObjectType
public java.lang.Class<?> getObjectType()
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<java.util.Collection<org.springframework.security.core.userdetails.UserDetails>>
-
setResourceLocation
public void setResourceLocation(java.lang.String resourceLocation)
Sets the location of a Resource that is a Properties file in the format defined inUserDetailsResourceFactoryBean.- Parameters:
resourceLocation- the location of the properties file that contains the users (i.e. "classpath:users.properties")
-
setResource
public void setResource(org.springframework.core.io.Resource resource)
Sets a Resource that is a Properties file in the format defined inUserDetailsResourceFactoryBean.- Parameters:
resource- the Resource to use
-
fromResourceLocation
public static UserDetailsResourceFactoryBean fromResourceLocation(java.lang.String resourceLocation)
Create a UserDetailsResourceFactoryBean with the location of a Resource that is a Properties file in the format defined inUserDetailsResourceFactoryBean.- Parameters:
resourceLocation- the location of the properties file that contains the users (i.e. "classpath:users.properties")- Returns:
- the UserDetailsResourceFactoryBean
-
fromResource
public static UserDetailsResourceFactoryBean fromResource(org.springframework.core.io.Resource propertiesResource)
Create a UserDetailsResourceFactoryBean with a Resource that is a Properties file in the format defined inUserDetailsResourceFactoryBean.- Parameters:
propertiesResource- the Resource that is a properties file that contains the users- Returns:
- the UserDetailsResourceFactoryBean
-
fromString
public static UserDetailsResourceFactoryBean fromString(java.lang.String users)
Creates a UserDetailsResourceFactoryBean with a resource from the provided String- Parameters:
users- the string representing the users- Returns:
- the UserDetailsResourceFactoryBean
-
-