Broadcast on Broadcast off
The Documentation for Project Zero has moved. Please update your bookmarks to: http://www.projectzero.org/documentation/
Table of
Contents...
Hide

Project Zero Developer’s Guide

Basic concepts
Core concepts overview
Event processing
Writing Java handlers
Writing Groovy handlers
Firing events
Global Context
Global Context reference
Application directory layout
Virtualized directories
Writing rich Web applications
Features and configuration
Configuration
Debugging
Dependencies
Packaging
Application Classpath
Logging and tracing
RESTful resources
Creating RESTful documentation
File serving
Response rendering
Validators and validation
HTTP error handling
Client programming with Dojo
Runtime Options
Deployment modifications
HTTP configuration
SSL configuration
Proxy configuration
Security
Security considerations
Authentication
Extending security
Security Tokens
Token support
Extending token support
Leveraging TAI
User service
File based user service
LDAP user service
Extending user service
Security Utilities
Leveraging XOREncoder
Assemble
Calling Out to a Remote Resource
Using the Connection API
Sending an email
Configuring destinations
Configuring protocols
Protocol reference
HTTP protocol
SMTP protocol
File protocol
Event protocol
Assemble Flows and Mediations
Using flows
Getting started with Assemble flow
Creating a simple feed flow
Creating a simple Assemble flow
Creating a simple extension
Problem determination
A Flow language example
Creating and running a new flow
Writing flows using a Groovy DSL
Creating new flow activities
Writing extensions in the flow language
Writing extensions in Groovy
Adding validation rule
Configuring the graphical tool
Using the GUI to work with flows
Feed perspective of the GUI tool
Advanced Features
Using the flow samples
Flow language reference
Flow language behavior and syntax
Running processes and activities
Built-in activities
Extension activities
Feed Operators
XML Operators
Using mediations
Configuring mediations
Creating new mediations
Supplied mediation steps
Static router
Java logger
XPath logger
REST2SOAP
Extensions
Atom support
Atom Enabling a Database
RSS support
JSON support
XMLEncoder
URIUtils
Developer Web tools
Data access
Common query patterns
Advanced query patterns
Update patterns
Local database transactions
Extending data access
Config vendor differences
PHP data access
Resource Model
Setup and configuration
Resource Model declaration
Programmatic Model API
HTTP REST API
Active content filtering support
Default filters
Custom filters
Other Extension Modules
Amazon E-Commerce Service
Reference
Zero command line interface
JavaDoc - Public API
JavaDoc - Public SPI
JavaDoc - All Classes
Samples and services
Samples
The Zero Zone Application
Services
Blogging service
Commenting service
File sharing service
Group service
Profile service
Rating service
Tagging service
Catalog Zero

 

File-based user service

User accounts are stored in the user file in the following format:

USERID:ENCRYPTED_PASSWORD[:<comma-delimited list of groups>]

The user service command is provided for creating and editing entries in the user file. You can use the user service command to:

  • Create a user account in a user file. If a user file does not exist, it creates a new user file.
  • Update a password in a user file.

The user file should be located in the <apphome>/config directory. The following sections of this article provide information about the file based user service:

For Eclipse users

To work with user accounts, if you use Eclipse, first locate the UserServiceCommand.class class in the following location: YOUR_ZERO_APP_PROJECT > Zero Resolved Libraries > ZERO_CORE_JAR_FILE (zero.core-VERSION_NUMBER.jar)> zero.core.security.userservice.

Creating a user account

To create a user account with Eclipse, use the following steps:

  1. Right click UserServiceCommand.class and from the context menu, select Run As > Java Application.
  2. The user service command prompts you to specify a path to a user file and you have the following options:
    • If you are using the default (./config/zero.users), click Enter.
    • If you are not using this default, enter a path name on the Eclipse console and click Enter. The following example shows a path name as you would enter it:
      2007/07/25 4:38:22 zero.core.security.userservice.UserServiceCommand getUserInput
      INFO: Location of user file [default ./config/zero.users]:
      c:\eclipse\workspace\dev\SampleApp\config\zero.users
            
  3. When the user service command prompts you for the task, type create on the Eclipse console, as shown in the following example, and click Enter.
    2007/07/25 4:49:33 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Type 'create' to create user, 'update' to update user or 'exit' when done. 
    create
          
  4. When prompted in the Eclipse console, type a user name, a password, and groups as shown in the following example:
    2007/07/25 4:49:36 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Enter username:
    user1
    2007/07/25 4:49:41 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Enter password:
    password1
    2007/07/25 4:49:54 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Enter group (or enter when done):
    GROUP1
          

    In this example, you would see the message User "user1" was successfully added to the user file. on the Eclipse console and you would also have a new user entry in the user file:

    user1: 7c6a180b36896a0a8c02787eeafb0e4c : GROUP1

    You can repeat step 3 and 4 to issue other command parameters to add or update users on the Eclipse console.

  5. When you finish interaction with the command, type exit at step 3 on the console and click Enter.

Updating a user account

To update a user account with Eclipse, use the following steps:

  1. Right click UserServiceCommand.class and, from the context menu, select Run As > Java Application.
  2. The user service command prompts you to specify a path to a user file and you have the following options:
    • If you are using the default (./config/zero.users), click Enter.
    • If you are not using this default, enter a path name on the Eclipse console and click Enter. The following example shows a path name as you would enter it:
      2007/07/25 4:49:33 zero.core.security.userservice.UserServiceCommand getUserInput
      INFO: Location of user file [default ./config/zero.users]:
      c:\eclipse\workspace\dev\SampleApp\config\zero.users
            
  3. When the user service command prompts you for the task, type update on the Eclipse console, as shown in the following example, and click Enter:
    2007/07/25 4:50:01 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Type 'create' to create user, 'update' to update user or 'exit' when done. 
    update
          
  4. When prompted in the Eclipse console, type a user name and a new password as shown in the following example:
    2007/07/25 4:59:52 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Enter username:
    user1
    2007/07/25 4:59:56 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Enter password:
    pwd1
    2007/07/25 5:00:10 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Hit enter to update user.
          

    In this example, you would see the message The password of the user "user1" was successfully updated. on the Eclipse console and you would have an updated entry in the user file.

    You can repeat step 3 and 4 to issue other command parameters to add or update users on the Eclipse console.

  5. When you finish interaction with the command, type exit at step 3 on the console and click Enter.

For command line users

The user service is included in the zero.core, therefore you must resolve the zero.core with the following steps:

  1. Change to the <zerohome> directory.
  2. Add the <zerohome> directory to the path environment variable.
  3. Create an application as shown in the following example:
    zero create SampleApp
  4. From the <apphome> directory, resolve dependencies using the following command:
    zero resolve

Now you can issue the user service command with the command line. Before you enter any commands note that, by default, all commands expect the user file to be in the following directory: <CURRENT_DIRECTORY>/config/zero.users. Also, it is very important to note whether the commands work correctly for your user file (zero.users). You can specify the path of the user file using -f option in every command syntax.

Creating a user account

To create a user account on the command line, use the following steps:

  1. Change to the <apphome>/config directory.
  2. Run the user service command as follows:
    zero user
  3. The user service command prompts you to specify a path to a user file and you have the following options:
    • If you are using the default (./config/zero.users), click Enter.
    • If you are not using this default, enter a path name and click Enter. The following example shows a path name as you would enter it:
      2007/07/25 4:38:22 zero.core.security.userservice.UserServiceCommand getUserInput
      INFO: Location of user file [default ./config/zero.users]:
      c:\zero\apps\SampleApp\config\zero.users
            
  4. When the user service command prompts you for the task, type create on the standard input, as shown in the following example, and click Enter:
    2007/07/25 4:49:33 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Type 'create' to create user, 'update' to update user or 'exit' when done. 
    create
          
  5. When prompted, type a user name, a password, and groups on the standard input as shown in the following example:
    2007/07/25 4:49:36 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Enter username:
    user1
    2007/07/25 4:49:41 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Enter password:
    password1
    2007/07/25 4:49:54 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Enter group (or enter when done):
    GROUP1
          

    In this example, you would see the message User "user1" was successfully added to the user file. on the standard output and you would also have a new user entry in the user file:

    user1: 7c6a180b36896a0a8c02787eeafb0e4c : GROUP1

    You can repeat step 3 and 4 to issue other command parameters to add or update users on the standard input.

  6. When you finish interaction with the command, type exit at step 3 and click Enter.

Updating a user account

To update a user account on the command line, use the following steps:

  1. Change to the <apphome>/config directory.
  2. Run the user service command as follows:
    zero user
  3. The user service command prompts you to specify a path to a user file and you have the following options:
    • If you are using the default (./config/zero.users), click Enter.
    • If you are not using this default, enter a path name on the standard input and click Enter. The following example shows a path name as you would enter it:
      2007/07/25 4:49:33 zero.core.security.userservice.UserServiceCommand getUserInput
      INFO: Location of user file [default ./config/zero.users]:
      c:\zero\apps\SampleApp\config\zero.users
            
  4. When the user service command prompts you for the task, type update on the standard input, as shown in the following example, and click Enter:
    2007/07/25 4:50:01 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Type 'create' to create user, 'update' to update user or 'exit' when done. 
    update
          
  5. When prompted on the standard output, type a user name and a new password as shown in the following example:
    2007/07/25 4:59:52 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Enter username:
    user1
    2007/07/25 4:59:56 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Enter password:
    pwd1
    2007/07/25 5:00:10 zero.core.security.userservice.UserServiceCommand getUserInput
    INFO: Hit enter to update user.
          

    In this example, you would see the message The password of the user "user1" was successfully updated. on the standard output and you would have an updated entry in the user file.

    You can repeat step 3 and 4 to issue other command parameters to add or update users on the standard input.

  6. When you finish interaction with the command, type exit at step 3 on the console and click Enter.

Advanced usage - non-interactive mode for command line users

The user service command directly accepts arguments with non-interactive fashion. You can make use of it with the command line.

Creating a user account

To create a user account in non-interactive mode, run the user service command as follows:

zero user [-f USER_FILE_PATH] create USERNAME PASSWORD "[GROUP]*"

For example:

zero user -f c:\zero\apps\SampleApp\config\zero.users create user1 password1 "GROUP1,TEAM1" 

This adds the following entry to the user file:

user1: 7c6a180b36896a0a8c02787eeafb0e4c : GROUP1,TEAM1

Updating a user account

To update a password in non-interactive mode, run the user service command as follows:

zero user [-f USER_FILE_PATH] update USERNAME PASSWORD

For example:

zero user -f c:\zero\apps\SampleApp\config\zero.users update user1 pwd1

The following message is returned:

The password of the user "user1" was successfully updated.

Notes:

  • Project Zero uses the file based user service as the default. You don't need to configure the zero.config file for the file based user service.
  • To delete user accounts and modify groups, you can use any editor because a user file is just a text file.
  • If you want to specify zero.users in an arbitrary path, you can define it in the zero.config file as shown in the following example:
       [/config/security/userservice]
       pathToUserfile=./a/b/c/config/zero.users
       

Web based administration of file-based user service registry

See the Web based administration of file-based user service registry section of the Developer Web tools article on how to leverage this library.

r28 - 22 Oct 2007 - 14:28:23 - todkap
Syndicate this site RSS ATOM
Copyright 2007 © IBM Corporation | Privacy | Terms of Use | About this site