Skip to content

Commit

Permalink
Publish config for cas & ldap
Browse files Browse the repository at this point in the history
  • Loading branch information
uyab committed Mar 18, 2019
1 parent 4ad289c commit cf0b3fa
Show file tree
Hide file tree
Showing 4 changed files with 762 additions and 0 deletions.
51 changes: 51 additions & 0 deletions app/Console/Commands/LdapLogin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Laravolt\Auth\Services\LdapService;

class LdapLogin extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ldap:login {username} {password}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Test login via LDAP';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle(LdapService $ldapService)
{
$username = $this->argument('username');
$password = $this->argument('password');

try {
$user = $ldapService->getUser(['password' => $password, config('laravolt.auth.identifier') => $username]);
dd($user);
} catch (\Exception $e) {
$this->error(get_class($e).":".$e->getMessage());
}
}
}
162 changes: 162 additions & 0 deletions config/cas.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| CAS Hostname
|--------------------------------------------------------------------------
| Example: 'cas.myuniv.edu'.
*/
'cas_hostname' => env('CAS_HOSTNAME', 'cas.myuniv.edu'),

/*
|--------------------------------------------------------------------------
| CAS Authorized Hosts
|--------------------------------------------------------------------------
| Example: 'cas.myuniv.edu'. This is used when SAML is active and is
| recommended for protecting against DOS attacks. If using load
| balanced hosts, then separate each with a comma.
*/
'cas_real_hosts' => env('CAS_REAL_HOSTS', 'cas.myuniv.edu'),


/*
|--------------------------------------------------------------------------
| Customize CAS Session Cookie Name
|--------------------------------------------------------------------------
*/
'cas_session_name' => env('CAS_SESSION_NAME', 'CASAuth'),

/*
|--------------------------------------------------------------------------
| Laravel has it's own authentication sessions. Unless you want phpCAS
| to manage the session, leave this set to false. Note that the
| middleware and redirect classes will be handling removal
| of the Laravel sessions when this is set to false.
|--------------------------------------------------------------------------
*/
'cas_control_session' => env('CAS_CONTROL_SESSIONS', false),

/*
|--------------------------------------------------------------------------
| Enable using this as a cas proxy
|--------------------------------------------------------------------------
*/
'cas_proxy' => env('CAS_PROXY', false),

/*
|--------------------------------------------------------------------------
| Cas Port
|--------------------------------------------------------------------------
| Usually 443
*/
'cas_port' => env('CAS_PORT', 443),

/*
|--------------------------------------------------------------------------
| CAS URI
|--------------------------------------------------------------------------
| Sometimes is /cas
*/
'cas_uri' => env('CAS_URI', '/cas'),

/*
|--------------------------------------------------------------------------
| CAS Validation
|--------------------------------------------------------------------------
| CAS server SSL validation: 'self' for self-signed certificate, 'ca' for
| certificate from a CA, empty for no SSL validation.
|
| VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL
*/
'cas_validation' => env('CAS_VALIDATION', ''),

/*
|--------------------------------------------------------------------------
| CA Certificate
|--------------------------------------------------------------------------
| Path to the CA certificate file. For production use set
| the CA certificate that is the issuer of the cert
*/
'cas_cert' => env('CAS_CERT', ''),

/*
|--------------------------------------------------------------------------
| CN Validation (if you are using CA certs)
|--------------------------------------------------------------------------
| If for some reason you want to disable validating the certificate
| intermediaries, here is where you can. Recommended to leave
| this set with default (true).
*/
'cas_validate_cn' => env('CAS_VALIDATE_CN', true),

/*
|--------------------------------------------------------------------------
| CAS Login URI
|--------------------------------------------------------------------------
| Empty is fine
*/
'cas_login_url' => env('CAS_LOGIN_URL', ''),

/*
|--------------------------------------------------------------------------
| CAS Logout URI
|--------------------------------------------------------------------------
*/
'cas_logout_url' => env('CAS_LOGOUT_URL', ''),

/*
|--------------------------------------------------------------------------
| CAS Logout Redirect Services
|--------------------------------------------------------------------------
| If your server supports redirection services, enter the redirect url
| in this section. If left blank, it will default to disabled.
*/
'cas_logout_redirect' => env('CAS_LOGOUT_REDIRECT', ''),

/*
|--------------------------------------------------------------------------
| CAS Successful Logon Redirection Url
|--------------------------------------------------------------------------
| By default, CAS will assume that the user should be redirected to the
| page in which the call was initiated. You can override this method
| and force the user to be redirected to a specific URL here.
*/
'cas_redirect_path' => env('CAS_REDIRECT_PATH', ''),

/*
|--------------------------------------------------------------------------
| CAS Supports SAML 1.1, allowing you to retrieve more than just the
| user identifier. If your CAS authentication service supports
| this feature, you may be able to retrieve user meta data.
|--------------------------------------------------------------------------
*/
'cas_enable_saml' => env('CAS_ENABLE_SAML', false),

/*
|--------------------------------------------------------------------------
| Enable PHPCas Debug Mode
| Options are:
| 1) true (defaults logfile creation to /tmp/phpCAS.log)
| 2) 'path/to/logfile'
| 3) false
|--------------------------------------------------------------------------
*/
'cas_debug' => env('CAS_DEBUG', storage_path('logs/cas.log')),


/*
|--------------------------------------------------------------------------
| Enable Verbose error messages. Not recommended for production.
| true | false
|--------------------------------------------------------------------------
*/
'cas_verbose_errors' => env('CAS_VERBOSE_ERRORS', false),

/*
|--------------------------------------------------------------------------
| This will cause CAS to skip authentication and assume this user id.
| This should only be used for developmental purposes. getAttributes()
| will return null in this condition.
*/
'cas_masquerade' => env('CAS_MASQUERADE', '')
];
Loading

0 comments on commit cf0b3fa

Please sign in to comment.