Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
labelabeille
server
Commits
773659e4
Commit
773659e4
authored
May 07, 2016
by
wilhelmhb
Browse files
entry point for authentication
parent
5566469b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ApiBundle/Entity/AuthenticationEntryPoint.php
0 → 100644
View file @
773659e4
<?php
namespace
ApiBundle\Entity
;
/* Imports */
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\Security\Core\Exception\AuthenticationException
;
use
Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface
;
/**
* Class AuthenticationEntryPoint
* Returns a 401 if the user is not logged in instead of redirecting to the login page
*
*/
class
AuthenticationEntryPoint
implements
AuthenticationEntryPointInterface
{
/**
* {@inheritdoc}
*/
public
function
start
(
Request
$request
,
AuthenticationException
$authException
=
null
)
{
$response
=
new
Response
(
''
,
401
);
$response
->
headers
->
set
(
'Content-Type'
,
'application/json'
);
return
$response
;
}
}
?>
Write
Preview
Supports
Markdown
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