Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
canap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SI-FSD
canap
Commits
8e73be0b
Commit
8e73be0b
authored
5 years ago
by
nicrausaz
Browse files
Options
Downloads
Patches
Plain Diff
Validation du groupe d'accès
parent
453414bd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
canapGEST/API/app/Http/Controllers/AuthController.php
+6
-6
6 additions, 6 deletions
canapGEST/API/app/Http/Controllers/AuthController.php
canapGEST/API/app/Providers/TequilaClient.php
+10
-6
10 additions, 6 deletions
canapGEST/API/app/Providers/TequilaClient.php
with
16 additions
and
12 deletions
canapGEST/API/app/Http/Controllers/AuthController.php
+
6
−
6
View file @
8e73be0b
...
...
@@ -40,7 +40,6 @@ class AuthController extends Controller
public
function
login
()
{
// TODO: Limit group access to canap-gest-users
$oClient
=
new
TequilaClient
(
"https://tequila.epfl.ch/cgi-bin/tequila/"
);
$oClient
->
setParam
(
...
...
@@ -48,19 +47,20 @@ class AuthController extends Controller
'urlacces'
=>
url
(
"/api/auth/tequilareturn"
),
'service'
=>
"Canap-Gest"
,
'language'
=>
"francais"
,
'usecookie'
=>
"on"
,
// 'allows' => "group=formateurs-epfl",
'usecookie'
=>
"off"
)
);
$oClient
->
setRequested
(
array
(
'request'
=>
"name,firstname,uniqueid,group"
,
//~
'require' => "ro
le-respaccred",
'require'
=>
"
g
ro
up=canap-gest-users"
)
);
if
(
!
empty
(
$_GET
[
'key'
]))
{
$attributs
=
$oClient
->
checkUser
(
$_GET
[
'key'
]);
if
(
!
$attributs
)
{
exit
(
"Unknown tequila error"
);
}
...
...
@@ -74,8 +74,8 @@ class AuthController extends Controller
public
function
tequilareturn
()
{
//
return redirect()->to("https://canap-gest-dev.local:8080/#/?key=" . $_GET["key"]);
return
redirect
()
->
to
(
"https://canap-gest.epfl.ch/#/?key="
.
$_GET
[
"key"
]);
return
redirect
()
->
to
(
"https://canap-gest-dev.local:8080/#/?key="
.
$_GET
[
"key"
]);
//
return redirect()->to("https://canap-gest.epfl.ch/#/?key=" . $_GET["key"]);
// PROD
}
public
function
logout
()
...
...
This diff is collapsed.
Click to expand it.
canapGEST/API/app/Providers/TequilaClient.php
+
10
−
6
View file @
8e73be0b
...
...
@@ -145,7 +145,7 @@ class TequilaClient {
// }
return
$url
;
}
/**
* Sends an authentication request to Tequila.
*/
...
...
@@ -165,18 +165,22 @@ class TequilaClient {
if
(
!
$response
)
{
return
false
;
}
$attributes
=
$this
->
parseAttributes
(
$response
);
// Check required
// Check required
foreach
(
$this
->
requested
as
$requestedAttributes
)
{
foreach
(
explode
(
","
,
$requestedAttributes
)
as
$requestedAttribute
)
{
if
(
!
array_key_exists
(
$requestedAttribute
,
$attributes
))
{
if
(
strpos
(
$requestedAttribute
,
'group='
)
!==
false
)
{
$requested_group
=
str_replace
(
'group='
,
''
,
$requestedAttribute
);
$user_groups
=
explode
(
','
,
$attributes
[
'group'
]);
if
(
!
in_array
(
$requested_group
,
$user_groups
))
{
exit
(
"Pas d'accès"
);
}
}
else
if
(
!
array_key_exists
(
$requestedAttribute
,
$attributes
))
{
exit
(
"Tequila error: missing attribute
$requestedAttribute
"
);
}
}
}
return
$attributes
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment