Package org.springframework.security.config.core.userdetails

# 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<Collection<org.springframework.security.core.userdetails.UserDetails>>`, `org.springframework.context.ResourceLoaderAware`

public class UserDetailsResourceFactoryBean extends Object implements org.springframework.context.ResourceLoaderAware, org.springframework.beans.factory.FactoryBean<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

## Field Summary

### Fields inherited from interface org.springframework.beans.factory.FactoryBean

`OBJECT_TYPE_ATTRIBUTE`

## Constructor Summary

Constructors
Constructor
Description
`UserDetailsResourceFactoryBean()`

## Method Summary

Modifier and Type
Method
Description
`static UserDetailsResourceFactoryBean`
`fromResource(org.springframework.core.io.Resource propertiesResource)`
Create a UserDetailsResourceFactoryBean with a Resource that is a Properties file in the format defined in `UserDetailsResourceFactoryBean`.
`static UserDetailsResourceFactoryBean`
`fromResourceLocation(String resourceLocation)`
Create a UserDetailsResourceFactoryBean with the location of a Resource that is a Properties file in the format defined in `UserDetailsResourceFactoryBean`.
`static UserDetailsResourceFactoryBean`
`fromString(String users)`
Creates a UserDetailsResourceFactoryBean with a resource from the provided String
`Collection<org.springframework.security.core.userdetails.UserDetails>`
`getObject()`
`Class<?>`
`getObjectType()`
`void`
`setResource(org.springframework.core.io.Resource resource)`
Sets a Resource that is a Properties file in the format defined in `UserDetailsResourceFactoryBean`.
`void`
`setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)`
`void`
`setResourceLocation(String resourceLocation)`
Sets the location of a Resource that is a Properties file in the format defined in `UserDetailsResourceFactoryBean`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.beans.factory.FactoryBean

`isSingleton`

## Constructor Details

### UserDetailsResourceFactoryBean

public UserDetailsResourceFactoryBean()

## Method Details

### setResourceLoader

public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)

Specified by:
  `setResourceLoader` in interface `org.springframework.context.ResourceLoaderAware`

### getObject

public Collection<org.springframework.security.core.userdetails.UserDetails> getObject() throws Exception

Specified by:
  `getObject` in interface `org.springframework.beans.factory.FactoryBean<Collection<org.springframework.security.core.userdetails.UserDetails>>`
Throws:
  `Exception`

### getObjectType

public Class<?> getObjectType()

Specified by:
  `getObjectType` in interface `org.springframework.beans.factory.FactoryBean<Collection<org.springframework.security.core.userdetails.UserDetails>>`

### setResourceLocation

public void setResourceLocation(String resourceLocation)
Sets the location of a Resource that is a Properties file in the format defined in `UserDetailsResourceFactoryBean`.

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 in `UserDetailsResourceFactoryBean`.

Parameters:
  `resource` - the Resource to use

### fromResourceLocation

public static UserDetailsResourceFactoryBean fromResourceLocation(String resourceLocation)
Create a UserDetailsResourceFactoryBean with the location of a Resource that is a Properties file in the format defined in `UserDetailsResourceFactoryBean`.

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 in `UserDetailsResourceFactoryBean`.

Parameters:
  `propertiesResource` - the Resource that is a properties file that contains the users
Returns:
  the UserDetailsResourceFactoryBean

### fromString

public static UserDetailsResourceFactoryBean fromString(String users)
Creates a UserDetailsResourceFactoryBean with a resource from the provided String

Parameters:
  `users` - the string representing the users
Returns:
  the UserDetailsResourceFactoryBean