Ajout intégration de l'hybridAuthentification encore en état de code brut
Pas de tests TODO: aller chercher les token et les id des authentifcation pour google, github, facebook, twitter ... Reste a tester et à décider pour les autres types d'authentification.
This commit is contained in:
parent
10a3060432
commit
41f2c5820b
14 changed files with 355 additions and 1 deletions
9
application/include/controlleurs/authentification.php
Normal file
9
application/include/controlleurs/authentification.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
require CONFIG_PATH . DIRECTORY_SEPARATOR . "authentification-config-example.php";
|
||||
|
||||
$hybridauth = new Hybridauth\Hybridauth($config);
|
||||
$adapters = $hybridauth->getConnectedAdapters();
|
||||
|
||||
$templateData['hybridauth'] = $hybridauth;
|
||||
$templateData['adapters'] = $adapters;
|
||||
18
application/include/controlleurs/compte.php
Normal file
18
application/include/controlleurs/compte.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
\MVC\Session::isregistered();
|
||||
|
||||
require CONFIG_PATH . DIRECTORY_SEPARATOR . "authentification-config-example.php";
|
||||
|
||||
$hybridauth = new Hybridauth\Hybridauth($config);
|
||||
$adapters = $hybridauth->getConnectedAdapters();
|
||||
|
||||
$templateData['adapters'] = $adapters;
|
||||
|
||||
$templateData['extractedData'] = [
|
||||
'token' => $_SESSION['userToken'],
|
||||
'identifier' => $_SESSION['userProfile']->identifier,
|
||||
'email' => $_SESSION['userProfile']->email,
|
||||
'first_name' => $_SESSION['userProfile']->firstName,
|
||||
'last_name' => $_SESSION['userProfile']->lastName,
|
||||
'photoURL' => strtok($_SESSION['userProfile']->photoURL, '?'),
|
||||
];
|
||||
4
application/include/modeles/authentification.model
Normal file
4
application/include/modeles/authentification.model
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
name : authentification
|
||||
page_title: Hybrid Authentification de l'application
|
||||
description : La page d'authentification
|
||||
params : params
|
||||
4
application/include/modeles/compte.model
Normal file
4
application/include/modeles/compte.model
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
name : compte
|
||||
page_title: Compte(s) utilisateurs de l'application
|
||||
description : La page d'accès privé
|
||||
params : params
|
||||
|
|
@ -1,9 +1,24 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>{{$page_title}}</title>
|
||||
<meta name="description" lang="fr" content="{{$description}}" />
|
||||
<meta name="description" lang="fr" content="{{$description}}"/>
|
||||
|
||||
@section('top-css')
|
||||
@endsection
|
||||
|
||||
@section('top-javascript')
|
||||
@endsection
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@yield('body')
|
||||
|
||||
@section('bottom-javascript')
|
||||
@endsection
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
33
application/include/vues/view/authentification.blade.php
Normal file
33
application/include/vues/view/authentification.blade.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
@extends('body')
|
||||
|
||||
@section('sidebar')
|
||||
@parent
|
||||
|
||||
<p>This is appended to the master sidebar.</p>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<h1>Sign in</h1>
|
||||
|
||||
<ul>
|
||||
@foreach ($hybridauth->getProviders() as $name)
|
||||
@if (!isset($adapters[$name]))
|
||||
<li>
|
||||
<a href="#" onclick="javascript:auth_popup('{{ $name }}');">
|
||||
Sign in with {{ $name }}
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
<ul>
|
||||
@endsection
|
||||
|
||||
@section('top-javascript')
|
||||
<script>
|
||||
function auth_popup(provider) {
|
||||
// replace 'path/to/hybridauth' with the real path to this script
|
||||
var authWindow = window.open('/control/authentification-callback-example/provider/' + provider, 'authWindow', 'width=600,height=400,scrollbars=yes');
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
32
application/include/vues/view/compte.blade.php
Normal file
32
application/include/vues/view/compte.blade.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
@extends('body')
|
||||
|
||||
@section('sidebar')
|
||||
@parent
|
||||
|
||||
<p>This is appended to the master sidebar.</p>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<h1>Compte utilisateur</h1>
|
||||
|
||||
@foreach ($extractedData as $key => $value)
|
||||
{{ $key }} :: {{ $value }}
|
||||
@endforeach
|
||||
|
||||
@if ($adapters)
|
||||
<h1>You are logged in:</h1>
|
||||
<ul>
|
||||
@foreach ($adapters as $name => $adapter)
|
||||
<li>
|
||||
<strong>{{$adapter->getUserProfile()->displayName }}</strong> from
|
||||
<i>{{ $name }}</i>
|
||||
<span>(<a href="{{$config['callback'] }}?logout={{ $name }}" ; ?>">Log Out</a>)</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
|
||||
|
||||
@endsection
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue