Skip to content

Commit

Permalink
Merge pull request #198 from silinternational/feature/material-module
Browse files Browse the repository at this point in the history
directly include the material module
  • Loading branch information
briskt authored May 24, 2024
2 parents af8912b + a488cbb commit ca28a15
Show file tree
Hide file tree
Showing 64 changed files with 4,038 additions and 38 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local.env
.vagrant
composer.phar
/nbproject/
local.*.env
*.env
*.aes
dockercfg
node_modules/
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
start: ssp

ssp: clean
docker-compose up -d ssp

hub: clean
docker-compose up -d ssp-hub.local ssp-sp1.local sp2 ssp-idp1.local idp2
docker-compose up -d ssp-hub.local

clean:
docker-compose kill
Expand All @@ -21,3 +16,15 @@ test:

test-integration:
docker-compose run --rm test ./run-integration-tests.sh

copyJsLib:
cp ./node_modules/@simplewebauthn/browser/dist/bundle/index.umd.min.js ./modules/material/www/simplewebauthn/browser.js
cp ./node_modules/@simplewebauthn/browser/LICENSE.md ./www/simplewebauthn/LICENSE.md

deps:
docker-compose run --rm node npm install --ignore-scripts
make copyJsLib

depsupdate:
docker-compose run --rm node npm update --ignore-scripts
make copyJsLib
79 changes: 75 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ must be installed.

[Make](https://www.gnu.org/software/make) is optional but simplifies the build process.

[Vagrant](https://www.vagrantup.com) for Windows users.
[PHP](https://www.php.net) and [Composer](https://getcomposer.org) are optional, but at a minimum you need COMPOSER_CACHE_DIR set to a local directory for storing the PHP dependency cache. This must be exported in your local development environment, not in the Docker container environment. For example, in your `~/.bashrc`, include `export COMPOSER_CACHE_DIR="$HOME/.composer"` and create an empty directory at `~/.composer`.

## Configuration
By default, configuration is read from environment variables. These are documented
Expand All @@ -34,9 +34,11 @@ will overwrite variables set in the execution environment.
## Local testing

1. `cp local.env.dist local.env` within project root and make adjustments as needed.
2. Add your github token to the `COMPOSER_AUTH` variable in the `local.env` file.
3. `make` or `docker-compose up -d` within the project root.
4. Visit http://localhost to see SSP running
2. `cp local.broker.env.dist local.broker.env` within project root and make adjustments as needed.
3. Add your github token to the `COMPOSER_AUTH` variable in the `local.env` file.
4. Create `localhost` aliases for `ssp-hub.local`, `ssp-idp1.local`, `ssp-idp2.local`, `ssp-idp3.local`, `ssp-sp1.local`, `ssp-sp2.local`, and `ssp-sp3.local`. This is typically done in `/etc/hosts`. _Example line: `127.0.0.1 ssp-hub.local ssp-idp1.local ssp-idp2.local ssp-idp3.local ssp-sp1.local ssp-sp2.local ssp-sp3.local`_
4. `make` or `docker-compose up -d` within the project root.
5. Visit http://ssp-hub.local to see SimpleSAMLphp

### Setup PhpStorm for remote debugging with Docker

Expand Down Expand Up @@ -172,6 +174,75 @@ This is adapted from the `ssp-iidp-expirycheck` and `expirycheck` modules.
Thanks to Alex Mihičinac, Steve Moitozo, and Steve Bagwell for the initial work
they did on those two modules.

### Material Module

Material Design theme for use with SimpleSAMLphp

#### Installation

```
composer.phar require silinternational/simplesamlphp-module-material:dev-master
```

#### Configuration

Update `/simplesamlphp/config/config.php`:

```
'theme.use' => 'material:material'
```

This project provides a convenience by loading this config with whatever is in the environment variable `THEME_USE`._

##### Google reCAPTCHA

If a site key has been provided in `$this->data['recaptcha.siteKey']`, the
username/password page may require the user prove his/her humanity.

##### Branding

Update `/simplesamlphp/config/config.php`:

```
'theme.color-scheme' => ['indigo-purple'|'blue_grey-teal'|'red-teal'|'orange-light_blue'|'brown-orange'|'teal-blue']
```

The login page looks for `/simplesamlphp/www/logo.png` which is **NOT** provided by default.

##### Analytics

Update `/simplesamlphp/config/config.php`:

```
'analytics.trackingId' => 'UA-some-unique-id-for-your-site'
```

This project provides a convenience by loading this config with whatever is in the environment variable `ANALYTICS_ID`._

##### Announcements

Update `/simplesamlphp/announcement/announcement.php`:

```
return 'Some <strong>important</strong> announcement';
```

By default, the announcement is whatever is returned by `/simplesamlphp/announcement/announcement.php`._

If provided, an alert will be shown to the user filled with the content of that announcement. HTML is supported.

#### Testing the Material theme

[Manual tests](./docs/material_tests.md)

#### i18n support

Translations are categorized by page in definition files located in the `dictionaries` directory.

Localization is affected by the configuration setting `language.available`. Only language codes found in this property will be utilized.
For example, if a translation is provided in Afrikaans for this module, the configuration must be adjusted to make 'af' an available
language. If that's not done, the translation function will not utilize the translations even if provided.

### Multi-Factor Authentication (MFA) simpleSAMLphp Module
A simpleSAMLphp module for prompting the user for MFA credentials (such as a
TOTP code, etc.).
Expand Down
1 change: 0 additions & 1 deletion development/hub/run-debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ echo "xdebug.remote_enable=1" >> $INI_FILE
echo "xdebug.remote_host=$XDEBUG_REMOTE_HOST" >> $INI_FILE

mkdir -p /data/vendor/simplesamlphp/simplesamlphp/modules/sildisco
touch /data/vendor/simplesamlphp/simplesamlphp/modules/sildisco/default-enable

# now the builtin run script can be started
/data/run.sh
48 changes: 22 additions & 26 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,4 @@
version: "2"
services:
ssp:
build: .
volumes:
# Utilize custom certs
- ./development/ssp/cert:/data/vendor/simplesamlphp/simplesamlphp/cert

# Utilize custom configs
- ./development/ssp/config/authsources.php:/data/vendor/simplesamlphp/simplesamlphp/config/authsources.php

# Configure the debugger
- ./development/ssp/run-debug.sh:/data/run-debug.sh

# Local modules
- ./modules/mfa:/data/vendor/simplesamlphp/simplesamlphp/modules/mfa
- ./modules/expirychecker:/data/vendor/simplesamlphp/simplesamlphp/modules/expirychecker
- ./modules/profilereview:/data/vendor/simplesamlphp/simplesamlphp/modules/profilereview
- ./modules/silauth:/data/vendor/simplesamlphp/simplesamlphp/modules/silauth
- ./modules/sildisco:/data/vendor/simplesamlphp/simplesamlphp/modules/sildisco

command: ["/data/run-debug.sh"]
ports:
- "80:80"
env_file:
- ./local.env

db:
image: mariadb:10
ports:
Expand Down Expand Up @@ -83,6 +57,7 @@ services:
- ./modules/profilereview:/data/vendor/simplesamlphp/simplesamlphp/modules/profilereview
- ./modules/silauth:/data/vendor/simplesamlphp/simplesamlphp/modules/silauth
- ./modules/sildisco:/data/vendor/simplesamlphp/simplesamlphp/modules/sildisco
- ./modules/material:/data/vendor/simplesamlphp/simplesamlphp/modules/material
command: ["/data/run-tests.sh"]

test-browser:
Expand All @@ -108,6 +83,13 @@ services:

ssp-hub.local:
build: .
depends_on:
- ssp-idp1.local
- ssp-idp2.local
- ssp-idp3.local
- ssp-sp1.local
- ssp-sp2.local
- ssp-sp3.local
volumes:
# Utilize custom certs
- ./development/hub/cert:/data/vendor/simplesamlphp/simplesamlphp/cert
Expand All @@ -133,6 +115,7 @@ services:
- ./modules/profilereview:/data/vendor/simplesamlphp/simplesamlphp/modules/profilereview
- ./modules/silauth:/data/vendor/simplesamlphp/simplesamlphp/modules/silauth
- ./modules/sildisco:/data/vendor/simplesamlphp/simplesamlphp/modules/sildisco
- ./modules/material:/data/vendor/simplesamlphp/simplesamlphp/modules/material
command: /data/run-debug.sh
ports:
- "80:80"
Expand Down Expand Up @@ -179,6 +162,7 @@ services:
- ./modules/profilereview:/data/vendor/simplesamlphp/simplesamlphp/modules/profilereview
- ./modules/silauth:/data/vendor/simplesamlphp/simplesamlphp/modules/silauth
- ./modules/sildisco:/data/vendor/simplesamlphp/simplesamlphp/modules/sildisco
- ./modules/material:/data/vendor/simplesamlphp/simplesamlphp/modules/material
command: >
bash -c "whenavail db 3306 60 /data/vendor/simplesamlphp/simplesamlphp/modules/silauth/lib/Auth/Source/yii migrate --interactive=0 &&
/data/run.sh"
Expand Down Expand Up @@ -231,6 +215,7 @@ services:
- ./modules/profilereview:/data/vendor/simplesamlphp/simplesamlphp/modules/profilereview
- ./modules/silauth:/data/vendor/simplesamlphp/simplesamlphp/modules/silauth
- ./modules/sildisco:/data/vendor/simplesamlphp/simplesamlphp/modules/sildisco
- ./modules/material:/data/vendor/simplesamlphp/simplesamlphp/modules/material
ports:
- "8086:80"
environment:
Expand Down Expand Up @@ -262,6 +247,7 @@ services:
- ./modules/profilereview:/data/vendor/simplesamlphp/simplesamlphp/modules/profilereview
- ./modules/silauth:/data/vendor/simplesamlphp/simplesamlphp/modules/silauth
- ./modules/sildisco:/data/vendor/simplesamlphp/simplesamlphp/modules/sildisco
- ./modules/material:/data/vendor/simplesamlphp/simplesamlphp/modules/material
ports:
- "8087:80"
env_file:
Expand Down Expand Up @@ -296,6 +282,7 @@ services:
- ./modules/profilereview:/data/vendor/simplesamlphp/simplesamlphp/modules/profilereview
- ./modules/silauth:/data/vendor/simplesamlphp/simplesamlphp/modules/silauth
- ./modules/sildisco:/data/vendor/simplesamlphp/simplesamlphp/modules/sildisco
- ./modules/material:/data/vendor/simplesamlphp/simplesamlphp/modules/material
ports:
- "8081:80"
environment:
Expand Down Expand Up @@ -326,6 +313,7 @@ services:
- ./modules/profilereview:/data/vendor/simplesamlphp/simplesamlphp/modules/profilereview
- ./modules/silauth:/data/vendor/simplesamlphp/simplesamlphp/modules/silauth
- ./modules/sildisco:/data/vendor/simplesamlphp/simplesamlphp/modules/sildisco
- ./modules/material:/data/vendor/simplesamlphp/simplesamlphp/modules/material
ports:
- "8082:80"
environment:
Expand Down Expand Up @@ -446,6 +434,14 @@ services:
- AWS_DEFAULT_REGION=us-east-1
- AWS_DYNAMODB_ENDPOINT=http://dynamo:8000

node:
image: node:lts-alpine
volumes:
- ./package.json:/data/package.json
- ./package-lock.json:/data/package-lock.json
- ./node_modules:/data/node_modules
working_dir: /data

networks:
default:
driver: bridge
Expand Down
Loading

0 comments on commit ca28a15

Please sign in to comment.