Skip to content

Commit

Permalink
Gestion connexion
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien Deshayes committed Dec 10, 2019
1 parent 9a4c244 commit 857f1a4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ OAUTH_AUTH_URL=http://membres.yourcoop.local/oauth/v2/auth
OAUTH_INFOS_URL=http://membres.yourcoop.local/api/oauth/nextcloud_user
###< hwi/oauth-bundle ###

LOGOUT_PAGE_URL=http://membres.yourcoop.local/logout

###> CUSTOM ###
APP_VIP_IPS=127.0.0.1
###< CUSTOM ###
2 changes: 2 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
app.vip_ips: '%env(APP_VIP_IPS)%'
logout_page_url: '%env(LOGOUT_PAGE_URL)%'

services:
# default configuration for services in *this* file
Expand All @@ -13,6 +14,7 @@ services:
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
bind:
$vipIps: '%app.vip_ips%'
$logoutPageUrl: '%logout_page_url%'

# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
Expand Down
5 changes: 3 additions & 2 deletions src/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class UserController extends AbstractFOSRestController
*
* @Route("/user/status", name="user_status", methods={"GET"})
*/
public function loginStatus()
public function loginStatus($logoutPageUrl)
{
$user = $this->getUser();

Expand All @@ -32,7 +32,8 @@ public function loginStatus()
'vip_ip' => $this->isGranted('ROLE_VIP_IP'),
'user' => null,
'oauth_url' => $this->generateUrl('hwi_oauth_service_redirect', ['service' => 'custom']),
'disconnect_url' => $this->generateUrl('logout')
'disconnect_url' => $this->generateUrl('logout'),
'logout_page_url' => $logoutPageUrl
];

if ($user) {
Expand Down

0 comments on commit 857f1a4

Please sign in to comment.