Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
60ab0b66
Commit
60ab0b66
authored
May 01, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finishing up auth re-write.
parent
60f61f31
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
64 deletions
+21
-64
auth.php
application/config/auth.php
+17
-51
session.php
application/config/session.php
+1
-1
routes.php
application/routes.php
+1
-1
auth.php
laravel/auth.php
+0
-10
driver.php
laravel/auth/drivers/driver.php
+2
-1
No files found.
application/config/auth.php
View file @
60ab0b66
...
...
@@ -4,78 +4,44 @@ return array(
/*
|--------------------------------------------------------------------------
|
Retrieve The Current Us
er
|
Default Authentication Driv
er
|--------------------------------------------------------------------------
|
|
This closure is called by the Auth class' "user" method when trying to
|
retrieve a user by the ID that is stored in their session. If you fi
nd
|
the user, just return the user object, but make sure it has an "id"
|
property. If you can't find the user, just return null
.
|
Laravel uses a flexible driver-based system to handle authentication.
|
You are free to register your own drivers using the Auth::exte
nd
|
method. Of course, a few great drivers are provided out of
|
box to handle basic authentication simply and easily
.
|
| Of course, a simple and elegant authentication solution has already
| been provided for you using the query builder and hashing engine.
| We love making your life as easy as possible.
| Drivers: 'fluent', 'eloquent'.
|
*/
'user'
=>
function
(
$id
)
{
if
(
filter_var
(
$id
,
FILTER_VALIDATE_INT
)
!==
false
)
{
return
DB
::
table
(
'users'
)
->
find
(
$id
);
}
},
'driver'
=>
'eloquent'
,
/*
|--------------------------------------------------------------------------
| Authenticat
e User Credentials
| Authenticat
ion Model
|--------------------------------------------------------------------------
|
| This closure is called by the Auth::attempt() method when attempting to
| authenticate a user that is logging into your application. It's like a
| super buff bouncer to your application.
|
| If the provided credentials are correct, simply return an object that
| represents the user being authenticated. As long as it has a property
| for the "id", any object will work. If the credentials are not valid,
| you don't meed to return anything.
|
*/
'attempt'
=>
function
(
$username
,
$password
)
{
$user
=
DB
::
table
(
'users'
)
->
where_username
(
$username
)
->
first
();
if
(
!
is_null
(
$user
)
and
Hash
::
check
(
$password
,
$user
->
password
))
{
return
$user
;
}
},
/*
|--------------------------------------------------------------------------
| Logout The Current User
|--------------------------------------------------------------------------
|
| Here you may do anything that needs to be done when a user logs out of
| your application, such as call the logout method on a third-party API
| you are using for authentication or anything else you desire.
| When using the "eloquent" authentication driver, you may specify the
| model that should be considered the "User" model. This model will
| be used to authenticate and load the users of your application.
|
*/
'
logout'
=>
function
(
$user
)
{}
,
'
model'
=>
'User'
,
/*
|--------------------------------------------------------------------------
|
"Remember Me" Cookie Nam
e
|
Authentication Tabl
e
|--------------------------------------------------------------------------
|
|
Here you may specify the cookie name that will be used for the cookie
| t
hat serves as the "remember me" token. Of course, a sensible default
|
has been set for you, so you probably don't need to change it
.
|
When using the "fluent" authentication driver, the database table used
| t
o load users may be specified here. This table will be used in by
|
the fluent query builder to authenticate and load your users
.
|
*/
'
cookie'
=>
'laravel_remember
'
,
'
table'
=>
'users
'
,
);
\ No newline at end of file
application/config/session.php
View file @
60ab0b66
...
...
@@ -16,7 +16,7 @@ return array(
|
*/
'driver'
=>
''
,
'driver'
=>
'
cookie
'
,
/*
|--------------------------------------------------------------------------
...
...
application/routes.php
View file @
60ab0b66
...
...
@@ -19,7 +19,7 @@
|
| You can even respond to more than one URI:
|
| Route::post(
'hello, world'
, function()
| Route::post(
array('hello', 'world')
, function()
| {
| return 'Hello World!';
| });
...
...
laravel/auth.php
View file @
60ab0b66
...
...
@@ -60,16 +60,6 @@ class Auth {
}
}
/**
* Run the logout method on all active drivers.
*
* @return void
*/
public
static
function
logout
()
{
array_walk
(
static
::
$drivers
,
function
(
$d
)
{
$d
->
logout
();
});
}
/**
* Register a third-party authentication driver.
*
...
...
laravel/auth/drivers/driver.php
View file @
60ab0b66
...
...
@@ -2,6 +2,7 @@
use
Laravel\Str
;
use
Laravel\Cookie
;
use
Laravel\Config
;
use
Laravel\Session
;
abstract
class
Driver
{
...
...
@@ -184,7 +185,7 @@ abstract class Driver {
extract
(
$config
);
Cookie
::
put
(
$name
,
$minutes
,
$
token
,
$path
,
$domain
,
$secure
);
Cookie
::
put
(
$name
,
$minutes
,
$
value
,
$path
,
$domain
,
$secure
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment