User Authentication

Set up a minimal authentication source

For purposes of getting started, we'll use the Apache htpasswd system for maintaining usernames and passwords.

$ htpasswd -c -s /home/username/htpasswd.conf username
New password: 
Re-type new password: 
Adding password for user username

Edit Solar.config.php

Solar needs to know what kind of authentication we're using; edit the Solar config file to provide this information.

$ mate Solar.config.php
<?php
$config = array();

// Front controller HREF prefix
$config['Solar_Uri_Action']['path'] = '/index.php';

// Public directory HREF prefix
$config['Solar_Uri_Public']['path'] = '/public';

// Authentication source
$config['Solar_Auth'] = array(
    'adapter' => 'Solar_Auth_Adapter_Htpasswd',
);

// Adapter information
$config['Solar_Auth_Adapter_Htpasswd'] = array(
    'file' => '/home/username/htpasswd.conf',
);

// Done!
return $config;
?>

Browse to "Hello-App"

http://127.0.0.1/index.php/hello-app

(The "app" version of "Hello World!" includes localization and authentication, making more like a real application.)

Attempt to log in with your username and password.

Other authentication sources

See the Solar_Auth package for the list of supported authentication sources.

 
manual/getting_started/user_authentication.txt · Last modified: 2008/08/25 08:48 (external edit)