Skip to content

Commit f39fb54

Browse files
committed
Initial commit
0 parents  commit f39fb54

File tree

4 files changed

+115
-0
lines changed

4 files changed

+115
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.idea

composer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "scoutingrudyardkipling/solopenidclient",
3+
"type": "library",
4+
"description": "Lightweight PHP5 library for easy SOL OpenID authentication.",
5+
"keywords": [
6+
"openid",
7+
"authentication",
8+
"security"
9+
],
10+
"homepage": "https://github.com/ScoutingRudyardKipling/SOLAuthenticator",
11+
"license": "MIT",
12+
"version": "1.0.0",
13+
"authors": [
14+
{
15+
"name": "Mewp",
16+
"homepage": "https://code.google.com/p/lightopenid/"
17+
},
18+
{
19+
"name": "Ignat Ignatov",
20+
"homepage": "https://github.com/iignatov/LightOpenID"
21+
},
22+
{
23+
"name": "Frank Kuipers",
24+
"homepage": "https://github.com/ScoutingRudyardKipling/SOLOpenIdClient"
25+
}
26+
],
27+
"require": {
28+
"php": ">=5.2"
29+
},
30+
"autoload": {
31+
"psr-4": {"ScoutingRudyardKipling\\": "src/"}
32+
}
33+
}

readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Scouting Nederland OpenId Client
2+
3+
### Installatie
4+
5+
Deze package is met composer toe te voegen middels het volgende commando:
6+
7+
```bash
8+
composer require scoutingrudyardkipling/solopenidclient
9+
```

src/SOLOpenIdClient.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
/**
3+
* Created by: Frank Kuipers
4+
* Date: 3-5-18
5+
* Time: 21:18
6+
*/
7+
8+
namespace ScoutingRudyardKipling;
9+
10+
/**
11+
* Class SOLOpenIdClient
12+
*
13+
* Please visit the documentation by SNL on their OpenId server for more information;
14+
* https://www.scouting.nl/downloads/ondersteuning/internet/2778-open-id-handleiding-voor-webmasters/file
15+
*
16+
* @package ScoutingRudyardKipling
17+
*/
18+
class SOLOpenIdClient extends \LightOpenID
19+
{
20+
21+
const THEME_LEAF = 'TC3_leaf';
22+
const THEME_EARTH = 'TC3_earth';
23+
const THEME_WATER = 'TC3_water';
24+
25+
private $theme = self::THEME_LEAF;
26+
27+
/**
28+
* Set the theme of the login page theme
29+
*
30+
* @param string $theme
31+
*/
32+
public function setTheme($theme = self::THEME_LEAF)
33+
{
34+
$this->theme = $theme;
35+
}
36+
37+
/**
38+
* Hack to disable discovery and install the correct configuration right away
39+
*
40+
* @param string $url
41+
* @return string
42+
*/
43+
function discover($url)
44+
{
45+
$this->ax = false;
46+
$this->sreg = true;
47+
$this->version = 2;
48+
$this->required = [
49+
'namePerson',
50+
'contact/email',
51+
'birthDate',
52+
'person/gender',
53+
'pref/language'
54+
];
55+
56+
return $this->server = "https://login.scouting.nl/provider/";
57+
}
58+
59+
/**
60+
* Hack to get one of the new fancy themes
61+
*
62+
* @return array
63+
*/
64+
protected function sregParams()
65+
{
66+
return parent::sregParams() + [
67+
'openid.ns_theme' => 'https://login.scouting.nl/ns/theme/1.0',
68+
'openid.theme_theme' => $this->theme
69+
];
70+
}
71+
72+
}

0 commit comments

Comments
 (0)