Skip to content

Commit

Permalink
Initial com_saml SAML IdP component (MVP)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkissebe committed Sep 11, 2024
1 parent 198e271 commit dd8a5ec
Show file tree
Hide file tree
Showing 14 changed files with 633 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/components/com_saml/admin/controllers/saml.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* @package hubzero-cms
* @copyright Copyright (c) 2005-2024 The Regents of the University of California.
* @license http://opensource.org/licenses/MIT MIT
*/

namespace Components\Saml\Admin\Controllers;

use Hubzero\Component\AdminController;

class SAML extends AdminController
{
public function displayTask()
{
$this->view->setLayout('saml')->display();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
; @package hubzero-cms
; @copyright Copyright (c) 2005-2024 The Regents of the University of California.
; @license http://opensource.org/licenses/MIT MIT

; Note : All ini files need to be saved as UTF-8 - No BOM

COM_SAML="SAML"
COM_CONFIG_IDP_FIELDSET_LABEL="Identity Provider"
COM_CONFIG_SP_FIELDSET_LABEL="Service Provider"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
; @package hubzero-cms
; @copyright Copyright (c) 2005-2024 The Regents of the University of California.
; @license http://opensource.org/licenses/MIT MIT

; Note : All ini files need to be saved as UTF-8 - No BOM

COM_SAML="SAML"

28 changes: 28 additions & 0 deletions core/components/com_saml/admin/saml.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* @package hubzero-cms
* @copyright Copyright (c) 2005-2024 The Regents of the University of California.
* @license http://opensource.org/licenses/MIT MIT
*/

namespace Components\Saml\Admin;

if (!\User::authorise('core.manage', 'com_saml'))
{
return \App::abort(404, \Lang::txt('JERROR_ALERTNOAUTHOR'));
}

$controllerName = \Request::getCmd('controller', 'saml');

if (!file_exists(__DIR__ . DS . 'controllers' . DS . $controllerName . '.php'))
{
$controllerName = 'saml';
}

require_once __DIR__ . DS . 'controllers' . DS . $controllerName . '.php';

$controllerName = __NAMESPACE__ . '\\Controllers\\' . ucfirst(strtolower($controllerName));

$controller = new $controllerName();

$controller->execute();
23 changes: 23 additions & 0 deletions core/components/com_saml/admin/views/saml/tmpl/saml.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* @package hubzero-cms
* @copyright Copyright (c) 2005-2024 The Regents of the University of California.
* @license http://opensource.org/licenses/MIT MIT
*/

// No direct access
defined('_HZEXEC_') or die();

Toolbar::title(Lang::txt('COM_SAML_TITLE'), 'SAML');

if (User::authorise('core.admin', $this->option))
{
Toolbar::preferences($this->option, '550');
}
?>

<section>
<div>
<p>There are no administrative functions for this component yet.</p>
</div>
</section>
17 changes: 17 additions & 0 deletions core/components/com_saml/config/access.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
@package hubzero-cms
@copyright Copyright (c) 2005-2024 The Regents of the University of California.
@license http://opensource.org/licenses/MIT MIT
-->

<access component="com_saml">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
</section>
</access>
107 changes: 107 additions & 0 deletions core/components/com_saml/config/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
@package hubzero-cms
@copyright Copyright (c) 2005-2024 The Regents of the University of California.
@license http://opensource.org/licenses/MIT MIT
-->

<config>
<fieldset name="IdP">
<field
name="IdP_enable"
type="radio"
default="1"
label="COM_SAML_CONFIG_FIELD_IDPENABLE_LABEL"
description="COM_SAML_CONFIG_FIELD_IDPENABLE_DESC">
<option
value="0">JNO</option>
<option
value="1">JYES</option>
</field>
<field
name="IdP_entityID"
type="text"
menu="hide"
default=""
label="COM_SAML_CONFIG_FIELD_IDPENTITYID_LABEL"
description="COM_SAML_CONFIG_FIELD_IDPENTITYID_DESC">
</field>
<field
name="enableIdPMetadataEndpoint"
type="radio"
default="1"
label="COM_SAML_CONFIG_FIELD_ENABLEIDPMETADATAENDPOINT_LABEL"
description="COM_SAML_CONFIG_FIELD_ENABLEIDPMETADATAENDPOINT_DESC">
<option
value="0">JNO</option>
<option
value="1">JYES</option>
</field>
<field
name="IdPCertificateFile"
type="text"
menu="hide"
default=""
label="COM_SAML_CONFIG_FIELD_IDPCERTIFICATEFILE_LABEL"
description="COM_SAML_CONFIG_FIELD_IDPCERTIFICATEFILE_DESC">
</field>
<field
name="IdPKeyFile"
type="text"
menu="hide"
default=""
label="COM_SAML_CONFIG_FIELD_IDPKEYFILE_LABEL"
description="COM_SAML_CONFIG_FIELD_IDPKEYFILE_DESC">
</field>

</fieldset>
<fieldset name="SP">
<field
name="SP_enable"
type="radio"
default="1"
label="COM_SAML_CONFIG_FIELD_SPENABLE_LABEL"
description="COM_SAML_CONFIG_FIELD_SPENABLE_DESC">
<option
value="0">JNO</option>
<option
value="1">JYES</option>
</field>
<field
name="SP_entityID"
type="text"
menu="hide"
default=""
label="COM_SAML_CONFIG_FIELD_SPENTITYID_LABEL"
description="COM_SAML_CONFIG_FIELD_SPENTITYID_DESC">
</field>
<field
name="enableSPMetadataEndpoint"
type="radio"
default="1"
label="COM_SAML_CONFIG_FIELD_ENABLESPMETADATAENDPOINT_LABEL"
description="COM_SAML_CONFIG_FIELD_ENABLESPMETADATAENDPOINT_DESC">
<option
value="0">JNO</option>
<option
value="1">JYES</option>
</field>
<field
name="SPCertificateFile"
type="text"
menu="hide"
default=""
label="COM_SAML_CONFIG_FIELD_SPCERTIFICATEFILE_LABEL"
description="COM_SAML_CONFIG_FIELD_SPCERTIFICATEFILE_DESC">
</field>
<field
name="SPKeyFile"
type="text"
menu="hide"
default=""
label="COM_SAML_CONFIG_FIELD_SPKEYFILE_LABEL"
description="COM_SAML_CONFIG_FIELD_SPKEYFILE_DESC">
</field>
</fieldset>
</config>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* @package hubzero-cms
* @copyright Copyright (c) 2005-2024 The Regents of the University of California.
* @license http://opensource.org/licenses/MIT MIT
*/

use Hubzero\Content\Migration\Base;

// No direct access
defined('_HZEXEC_') or die();

/**
* Migration script for adding component entry for com_saml
**/
class Migration20240820152900ComSaml extends Base
{
/**
* Up
**/
public function up()
{
$this->addComponentEntry('saml');
}

/**
* Down
**/
public function down()
{
$this->deleteComponentEntry('saml');
}
}
Loading

0 comments on commit dd8a5ec

Please sign in to comment.