Skip to content

Commit 975ed39

Browse files
committed
Merge branch 'release-3.0'
2 parents 29d5067 + 089d45f commit 975ed39

File tree

7 files changed

+69
-1967
lines changed

7 files changed

+69
-1967
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [v3.0.0] - 2023-05-05
9+
10+
### Added
11+
12+
- Add option for showing/hiding ID Token from dashboard
13+
14+
### Changed
15+
16+
- Update composer dependencies
17+
- Use `jumbojett/openid-connect-php` from composer
18+
19+
### Fixed
20+
21+
- Use font awesome from composer
22+
- Use minified CSS and JS
23+
- Handle issuer with trailing slash correctly
24+
25+
### Removed
26+
27+
- Remove support for PHP 5
28+
829
## [v2.3.1] - 2022-09-07
930

1031
### Fixed

README.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ First you need to install apache and composer
1414

1515
```shell
1616
sudo apt-get update
17-
sudo apt-get install apache2 curl php-cli git
17+
sudo apt-get install apache2 curl php-cli php-json php-xml git
1818
php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');"
1919
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
2020
```
@@ -55,18 +55,26 @@ tar -zxvf simple-oidc-client-php-X.Y.Z.tar.gz
5555

5656
## Simple OIDC Client - authentication
5757

58-
Now that we have everything we need, we can configure our login settings in
58+
Now that you have everything you need, you can configure your login settings in
5959
`config.php`.
60+
First, copy the configuration file, using the command:
61+
62+
```shell
63+
cp example-config.php config.php
64+
```
65+
66+
Then open the file and configure the portal.
6067

6168
```php
6269
<?php
6370

6471
// index.php interface configuration
6572
$title = "Generate Tokens";
66-
$img = "https://clickhelp.co/images/feeds/blog/2016.05/keys.jpg";
73+
$img = "https://www.pngkey.com/png/detail/233-2332677_image-500580-placeholder-transparent.png";
6774
$scopeInfo = "This service requires the following permissions for your account:";
75+
6876
// Client configuration
69-
$issuer = "https://example.com/oidc/";
77+
$issuer = "https://example.com/auth/realms/rciam";
7078
$clientId = "some-client-id";
7179
$clientSecret = "some-client-secret"; // comment if you are using PKCE
7280
// $pkceCodeChallengeMethod = "S256"; // uncomment to use PKCE
@@ -82,11 +90,15 @@ $scopesDefine = array(
8290
$refreshTokenNote = "NOTE: New refresh tokens expire in 12 months.";
8391
$accessTokenNote = "NOTE: New access tokens expire in 1 hour.";
8492
$manageTokenNote = "You can manage your refresh tokens in the following link: ";
85-
$manageTokens = $issuer . "manage/user/services";
86-
$sessionName = "oidc-client";
93+
$manageTokens = $issuer . "/account/#/applications";
94+
$sessionName = "simple-oidc-client-php"; // This value must be the same with the name of the parent directory
8795
$sessionLifetime = 60 * 60; // must be equal to access token validation time in seconds
96+
$bannerText = "";
97+
$bannerType = "info"; // Select one of "info", "warning", "error" or "success"
8898
$allowIntrospection = false;
89-
$enableActiveTokensTable = false;
99+
$enableActiveTokensTable = false; // This option works only for MITREid Connect based OPs
100+
$showIdToken = false;
101+
90102
```
91103

92104
Let’s go quickly through the settings:
@@ -95,9 +107,10 @@ Let’s go quickly through the settings:
95107
- `img` required, is the source of the logo
96108
- `scopeInfo` optional, is a message that informs the user for the application
97109
requirements
98-
- `issuer` required, is the base URL of our IdentityServer instance. This will
99-
allow oidc-client to query the metadata endpoint so it can validate the tokens
100-
- `clientId` required, is the id of the client we want to use when hitting the
110+
- `issuer` required, is the base URL of your OpenID Provider instance. This
111+
will allow oidc-client to query the metadata endpoint so it can validate the
112+
tokens
113+
- `clientId` required, is the id of the client you want to use when hitting the
101114
authorization endpoint
102115
- `clientSecret` optional, a value the offers better security to the message
103116
flow
@@ -117,7 +130,8 @@ Let’s go quickly through the settings:
117130
- `manageTokenNote` optional, message the informs the user where can manage
118131
his tokens
119132
- `manageTokens` optional, URL of the manage tokens service
120-
- `sessionName` required, define the name of the cookie session
133+
- `sessionName` required, define the name of the cookie session. The value must
134+
be the same with the name of the parent directory
121135
- `sessionLifetime` required, define the duration of the session. This must be
122136
equal to the validity time of the access token.
123137
- `bannerText` optional, the text that the banner will contain.
@@ -129,4 +143,7 @@ Let’s go quickly through the settings:
129143
- `warning`
130144
- `allowIntrospection` required, define to show/hide the introspection command
131145
- `enableActiveTokensTable` required, define to show/hide the Active Refresh
132-
Token table in `refreshtoken.php`
146+
Token table in `refreshtoken.php`. Important note: This option works only for
147+
[MITREid Connect](https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server)
148+
based OPs!
149+
- `showIdToken` required, define to show/hide the ID Token from the dashboard

composer.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
{
2-
"name": "jumbojett/openid-connect-php",
3-
"description": "Bare-bones OpenID Connect client",
2+
"name": "rciam/simple-oidc-client-php",
3+
"description": "A simple OpenID Connect (OIDC) client for browser-based applications in PHP",
44
"require": {
5-
"php": ">=5.6",
6-
"phpseclib/phpseclib" : "^2.0",
7-
"ext-json": "*",
8-
"ext-curl": "*",
5+
"php": ">=7.0",
96
"twbs/bootstrap": "^4.0",
10-
"paragonie/random_compat":"2.0.19",
117
"components/jquery": "^3.3",
12-
"components/font-awesome": "^5.15"
8+
"components/font-awesome": "^5.15",
9+
"jumbojett/openid-connect-php": "^0.9"
1310
},
1411
"archive" : {
1512
"exclude" : [

example-config.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
$accessTokenNote = "NOTE: New access tokens expire in 1 hour.";
2424
$manageTokenNote = "You can manage your refresh tokens in the following link: ";
2525
$manageTokens = $issuer . "manage/user/services";
26-
$sessionName = "oidc-client";
26+
$sessionName = "simple-oidc-client-php"; // This value must be the same with the name of the parent directory
2727
$sessionLifetime = 60 * 60; // must be equal to access token validation time in seconds
2828
$bannerText = "";
2929
$bannerType = "info"; // Select one of "info", "warning", "error" or "success"
3030
$allowIntrospection = false;
31-
$enableActiveTokensTable = false;
31+
$enableActiveTokensTable = false; // This option works only for MITREid Connect based OPs
32+
$showIdToken = false;

refreshtoken.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121

2222
<div class="tab-content">
2323
<div id="accessTokenMenu" class="tab-pane active">
24+
<?php if ($showIdToken) : ?>
25+
<div>
26+
<p class="lead" style="margin-bottom: 0px;">ID Token: </p>
27+
<input id="idToken" size=70 type="text" readonly style="cursor: text;" value="<?php echo $idToken; ?>" />
28+
<button id="copy-mAccessT" style="cursor: pointer" class="btn btn-copy btn-primary"><em class="icon-file"></em> Copy</button>
29+
</div>
30+
<?php endif; ?>
2431
<div>
2532
<p class="lead" style="margin-bottom: 0px;">Access Token: </p>
2633
<input id="accessToken" size=70 type="text" readonly style="cursor: text;" value="<?php echo $accessToken; ?>" />

resources/controllers/session.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,26 @@
5858
$sub = $oidc->requestUserInfo('sub');
5959
if ($sub) {
6060
$accessToken = $_SESSION['access_token'];
61+
$idToken = $_SESSION['id_token'];
6162
$_SESSION['refresh_token'] = $refreshToken;
6263
}
6364
unset($_SESSION['action']);
6465
} else {
6566
$accessToken = $_SESSION['access_token'];
67+
$idToken = $oidc->getIdToken();
6668
$refreshToken = $_SESSION['refresh_token'];
6769
unset($_SESSION['action']);
6870
}
6971
} else {
7072
$oidc->authenticate();
7173
$accessToken = $oidc->getAccessToken();
74+
$idToken = $oidc->getIdToken();
7275
$refreshToken = $oidc->getRefreshToken();
7376
$sub = $oidc->requestUserInfo('sub');
7477
if ($sub) {
7578
$_SESSION['sub'] = $sub;
7679
$_SESSION['access_token'] = $accessToken;
80+
$_SESSION['id_token'] = $idToken;
7781
$_SESSION['refresh_token'] = $refreshToken;
7882
$_SESSION['CREATED'] = time();
7983
}

0 commit comments

Comments
 (0)