Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
70eaef0
Add initial code
matiasperrone-exo Sep 5, 2025
cfc492f
Add call fixes
matiasperrone-exo Sep 5, 2025
a90be9c
Move to use GuzzleHttp as requested and use similar code from provide…
matiasperrone-exo Sep 8, 2025
84fe462
Copy code from summit-api
matiasperrone-exo Sep 9, 2025
29868f5
Add Guzzle Retry package
matiasperrone-exo Sep 9, 2025
d158822
Remove unnecessary comments
matiasperrone-exo Sep 9, 2025
9706f30
Reuse parent code
matiasperrone-exo Sep 9, 2025
a587b45
Revert yarn lock file
matiasperrone-exo Sep 9, 2025
1034c7b
Add OIDC PUBLIC in the Readme file
matiasperrone-exo Sep 9, 2025
93b9175
Remove debug console.log values
matiasperrone-exo Sep 9, 2025
7ac652c
Update env var names
matiasperrone-exo Sep 9, 2025
a2f51df
Rename files
matiasperrone-exo Sep 9, 2025
57953d5
Fix Content-type JSON
matiasperrone-exo Sep 9, 2025
17feaf1
Fix Content-type JSON
matiasperrone-exo Sep 9, 2025
fa3b09a
Remve console.log and finish JS code
matiasperrone-exo Sep 10, 2025
d9f1322
Add debug log
matiasperrone-exo Sep 10, 2025
3cf01b3
Add same-origin security verification
matiasperrone-exo Sep 12, 2025
10381ce
Send bad request when security validations are not met
matiasperrone-exo Sep 12, 2025
5182de3
Enhance check for same-origin
matiasperrone-exo Sep 12, 2025
43ebeb1
Move checked to an external localStorage key, moved to authInfoChecked
matiasperrone-exo Sep 12, 2025
7bfd3c9
Rename ENV vars
matiasperrone-exo Sep 12, 2025
40a5724
Add check for user_external_id first
matiasperrone-exo Sep 12, 2025
f804810
Remove repeated code and fix missing field in request processing
matiasperrone-exo Sep 12, 2025
0babd29
chore: Only mark authInfo as sso:bootstrapped true when 204, 404 or '…
matiasperrone-exo Sep 12, 2025
624b42c
chore: Remove payload as is not needed
matiasperrone-exo Sep 12, 2025
3a30e8a
chore: Remove body checks as is not used anywhere
matiasperrone-exo Sep 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Unless otherwise noted, all code is released under the APACHE 2.0 License http:/
## Installation and further documentation

Detailed installation instructions for a virtual machine environment using Vagrant are located at:
[Vagrant virtual machine installation](./installation.md)
[Vagrant virtual machine installation](./installation.md)

Information for installation to a local machine environment can be found at:
<http://openstackweb.github.io/openstack-org/>
Expand All @@ -41,7 +41,7 @@ configuration file for this should be located here

openstack/_config/cloudassets.yml

and with following content
and with following content


* https://docs.openstack.org/keystone/rocky/user/application_credentials.html
Expand All @@ -62,8 +62,8 @@ CloudAssets:
ApplicationCredentialId: application credential id
ApplicationCredentialSecret: application credential secret
ProjectName: your project name
AuthURL: keystone base url
LocalCopy: false
AuthURL: keystone base url
LocalCopy: false
````

## OIDC
Expand All @@ -73,19 +73,23 @@ settings for oidc configuration on _ss_environment.php file
````PHP
// OIDC
define('OIDC_CLIENT', '');

define('OIDC_CLIENT_SECRET', '');
//set true on production mode, otherwise false
define('OIDC_VERIFY_HOST',false);


define('SESSION_CHECKER_OAUTH2_APP_CLIENT_ID', '');
define('SESSION_CHECKER_OAUTH2_APP_CLIENT_SECRET', '');
//set true on production mode, otherwise false
define('OIDC_VERIFY_HOST',false);
define('SESSION_CHECKER_OAUTH2_APP_VERIFY_HOST', false);

````

on idp under allowed URIs you need to register following one

* https://hostname/openstackidauthenticator

under security settings you need to set Id Token Signed Response Algorithm
under security settings you need to set Id Token Signed Response Algorithm



3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
"php-opencloud/openstack": "dev-master",
"jumbojett/openid-connect-php": "dev-master",
"mikehaertl/phpwkhtmltopdf": "dev-master",
"spatie/dropbox-api": "dev-master"
"spatie/dropbox-api": "dev-master",
"caseyamcl/guzzle_retry_middleware": "2.13.0"
},
"require-dev": {
"phpunit/phpunit": "^7.0",
Expand Down
112 changes: 93 additions & 19 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion openstack/code/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public static function IconShortCodeHandler($arguments, $caption = null, $parser
//return the customized template
return $template->process(new ArrayData($customise));

}
}


function requireDefaultRecords()
Expand Down Expand Up @@ -274,6 +274,22 @@ public function getTime()
return time();
}

public function getSecurityToken()
{
return SecurityToken::inst() ? str_replace('"', '\\"', SecurityToken::inst()->getValue()) : null;
}

public function getIsSSOBootstrapEnabled()
{
$enabled = (bool) (defined('SHELL_SSO_BOOTSTRAP_ENABLED') and SHELL_SSO_BOOTSTRAP_ENABLED);
return $enabled and Member::currentUserID() !== null;
}

public function getMemberIsLoggedIn()
{
return Member::currentUserID() !== null;
}

protected function CustomScripts()
{
$js_files = [
Expand Down
34 changes: 31 additions & 3 deletions openstack/code/utils/apis/AbstractRestfulJsonApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
use Doctrine\Common\Annotations\AnnotationReader;
use Openstack\Annotations\CachedMethod;
use Doctrine\Common\Annotations\AnnotationReader;
/**
* Class AbstractRestfulJsonApi
*/
Expand Down Expand Up @@ -521,6 +521,19 @@ protected function published()
return $response;
}

/**
* @return SS_HTTPResponse
*/
protected function noContent(): SS_HTTPResponse
{
$response = new SS_HTTPResponse();
$response->setStatusCode(204);
$response->addHeader('Content-Type', 'application/json');
$response->setBody('');

return $response;
}

/**
* @return SS_HTTPResponse
*/
Expand Down Expand Up @@ -550,10 +563,10 @@ public function forbiddenError()
* @param $messages
* @return SS_HTTPResponse
*/
public function validationError($messages)
public function validationError($messages, $code = 412)
{
$response = new SS_HTTPResponse();
$response->setStatusCode(412);
$response->setStatusCode($code);
$response->addHeader('Content-Type', 'application/json');
if (!is_array($messages)) {
$messages = [['message' => $messages]];
Expand All @@ -579,6 +592,21 @@ protected function created($id)
return $response;
}

/**
* @return SS_HTTPResponse
*/
public function badRequest($message = "Bad Request")
{
$response = new SS_HTTPResponse();
$response->setStatusCode(400);
$response->addHeader('Content-Type', 'application/json');
$response->setBody(json_encode(
['error' => 'validation', 'messages' => [['message' => $message]]]
));

return $response;
}


/**
* @return SS_HTTPResponse
Expand Down
1 change: 1 addition & 0 deletions openstackid/_config/routes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Name: openstackidroutes
Director:
rules:
'OpenStackIdAuthenticator': 'OpenStackIdAuthenticator'
'oidc/session/bootstrap': 'OIDCSessionBootstrapApi'

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Libs\OAuth2;

/**
* Copyright 2015 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

use Exception;

/**
* Class InvalidGrantTypeException
* @package libs\oauth2
*/
class InvalidGrantTypeException extends Exception
{
public function __construct($message = "")
{
$message = "Invalid Grant Type : " . $message;
parent::__construct($message, 0, null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Libs\OAuth2;

/**
* Copyright 2015 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

use \Exception;

class OAuth2InvalidIntrospectionResponse extends Exception
{
public function __construct($message = "")
{
$message = "Invalid Introspection Response : " . $message;
parent::__construct($message, 0, null);
}
}
Loading