org.wildfly.extras.creaper.commands.auth
Class PropertiesFileAuth

java.lang.Object
  extended by org.wildfly.extras.creaper.commands.auth.PropertiesFileAuth

public final class PropertiesFileAuth
extends Object

Provides a set of offline commands to manipulate authentication and authorization .properties files.

The generic factory methods (inConfigurationDirectory(String) or of(java.io.File)) return an instance of this class, so that methods for working with users and methods for working with user mappings are both available.

The configuration file specific factory methods (applicationUsers(), applicationRoles(), mgmtUsers() and mgmtGroups()) return an instance of a view class that only exposes methods for working with users (PropertiesFileAuth.Users) or methods for working with user mappings (PropertiesFileAuth.UserMappings). This is only for convenience (static checking), there's no change in functionality.


Nested Class Summary
static class PropertiesFileAuth.UserMappings
          Convenience view on PropertiesFileAuth that only exposes methods for working with user mappings.
static class PropertiesFileAuth.Users
          Convenience view on PropertiesFileAuth that only exposes methods for working with users.
 
Method Summary
static PropertiesFileAuth.UserMappings applicationRoles()
          Creates a PropertiesFileAuth.UserMappings object for the application-roles.properties file in the configuration directory of the OfflineManagementClient.
static PropertiesFileAuth.Users applicationUsers()
          Creates a PropertiesFileAuth.Users object for the application-users.properties file in the configuration directory of the OfflineManagementClient.
 OfflineCommand defineUser(String username, String password)
          Ensures that the .properties file, which must be a *-users.properties file, contains a definition of a user with given username and given password.
 OfflineCommand defineUserMapping(String username, String roleOrGroup)
          Ensures that the .properties file, which must be a *-<groups|roles>.properties file, contains a mapping of a user with given username to given role/group (roleOrGroup).
static PropertiesFileAuth inConfigurationDirectory(String fileName)
          Creates a PropertiesFileAuth object for the file named fileName that resides in the configuration directory of the OfflineManagementClient.
static PropertiesFileAuth.UserMappings mgmtGroups()
          Creates a PropertiesFileAuth.UserMappings object for the mgmt-groups.properties file in the configuration directory of the OfflineManagementClient.
static PropertiesFileAuth.Users mgmtUsers()
          Creates a PropertiesFileAuth.Users object for the mgmt-users.properties file in the configuration directory of the OfflineManagementClient.
static PropertiesFileAuth of(File file)
          Creates a PropertiesFileAuth object for given file.
 OfflineCommand undefineUser(String username)
          Ensures that the .properties file, which must be a *-users.properties file, doesn't contain a definition of a user with given username.
 OfflineCommand undefineUserMapping(String username, String roleOrGroup)
          Ensures that the .properties file, which must be a *-<groups|roles>.properties file, doesn't contain a mapping of a user with given username to given role/group (roleOrGroup).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

applicationUsers

public static PropertiesFileAuth.Users applicationUsers()
Creates a PropertiesFileAuth.Users object for the application-users.properties file in the configuration directory of the OfflineManagementClient.


applicationRoles

public static PropertiesFileAuth.UserMappings applicationRoles()
Creates a PropertiesFileAuth.UserMappings object for the application-roles.properties file in the configuration directory of the OfflineManagementClient.


mgmtUsers

public static PropertiesFileAuth.Users mgmtUsers()
Creates a PropertiesFileAuth.Users object for the mgmt-users.properties file in the configuration directory of the OfflineManagementClient.


mgmtGroups

public static PropertiesFileAuth.UserMappings mgmtGroups()
Creates a PropertiesFileAuth.UserMappings object for the mgmt-groups.properties file in the configuration directory of the OfflineManagementClient.


inConfigurationDirectory

public static PropertiesFileAuth inConfigurationDirectory(String fileName)
Creates a PropertiesFileAuth object for the file named fileName that resides in the configuration directory of the OfflineManagementClient.


of

public static PropertiesFileAuth of(File file)
Creates a PropertiesFileAuth object for given file.


defineUser

public OfflineCommand defineUser(String username,
                                 String password)
Ensures that the .properties file, which must be a *-users.properties file, contains a definition of a user with given username and given password.


undefineUser

public OfflineCommand undefineUser(String username)
Ensures that the .properties file, which must be a *-users.properties file, doesn't contain a definition of a user with given username.


defineUserMapping

public OfflineCommand defineUserMapping(String username,
                                        String roleOrGroup)
Ensures that the .properties file, which must be a *-<groups|roles>.properties file, contains a mapping of a user with given username to given role/group (roleOrGroup).


undefineUserMapping

public OfflineCommand undefineUserMapping(String username,
                                          String roleOrGroup)
Ensures that the .properties file, which must be a *-<groups|roles>.properties file, doesn't contain a mapping of a user with given username to given role/group (roleOrGroup).



Copyright © 2016. All rights reserved.