Skip to content

Commit 376431b

Browse files
committed
adding after gitignore removal
1 parent b0803ba commit 376431b

File tree

272 files changed

+28241
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+28241
-0
lines changed

.extlib/simplesamlphp/modules/authorize/LICENSE

Lines changed: 459 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Authorize
2+
3+
![Build Status](https://github.com/simplesamlphp/simplesamlphp-module-authorize/workflows/CI/badge.svg?branch=master)
4+
[![Coverage Status](https://codecov.io/gh/simplesamlphp/simplesamlphp-module-authorize/branch/master/graph/badge.svg)](https://codecov.io/gh/simplesamlphp/simplesamlphp-module-authorize)
5+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/simplesamlphp/simplesamlphp-module-authorize/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/simplesamlphp/simplesamlphp-module-authorize/?branch=master)
6+
[![Type Coverage](https://shepherd.dev/github/simplesamlphp/simplesamlphp-module-authorize/coverage.svg)](https://shepherd.dev/github/simplesamlphp/simplesamlphp-module-authorize)
7+
[![Psalm Level](https://shepherd.dev/github/simplesamlphp/simplesamlphp-module-authorize/level.svg)](https://shepherd.dev/github/simplesamlphp/simplesamlphp-module-authorize)
8+
9+
## Install
10+
11+
Install with composer
12+
13+
```bash
14+
vendor/bin/composer require simplesamlphp/simplesamlphp-module-authorize
15+
```
16+
17+
## Configuration
18+
19+
Next thing you need to do is to enable the module: in `config.php`,
20+
search for the `module.enable` key and set `authorize` to true:
21+
22+
```php
23+
'module.enable' => [
24+
'authorize' => true,
25+
26+
],
27+
```
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "simplesamlphp/simplesamlphp-module-authorize",
3+
"description": "This module provides a user authorization filter based on attribute matching",
4+
"type": "simplesamlphp-module",
5+
"keywords": ["simplesamlphp", "authorize"],
6+
"license": "LGPL-2.1-or-later",
7+
"authors": [
8+
{
9+
"name": "Ernesto Revilla",
10+
"email": "erny@yaco.es"
11+
}
12+
],
13+
"config": {
14+
"preferred-install": {
15+
"simplesamlphp/simplesamlphp": "source",
16+
"*": "dist"
17+
},
18+
"allow-plugins": {
19+
"composer/package-versions-deprecated": true,
20+
"dealerdirect/phpcodesniffer-composer-installer": true,
21+
"phpstan/extension-installer": true,
22+
"simplesamlphp/composer-module-installer": true
23+
}
24+
},
25+
"autoload": {
26+
"psr-4": {
27+
"SimpleSAML\\Module\\authorize\\": "src/"
28+
}
29+
},
30+
"autoload-dev": {
31+
"psr-4": {
32+
"SimpleSAML\\Module\\Authorize\\Tests\\Utils\\": "tests/Utils",
33+
"SimpleSAML\\Test\\Utils\\": "vendor/simplesamlphp/simplesamlphp/tests/Utils"
34+
}
35+
},
36+
"require": {
37+
"php": "^8.1",
38+
"simplesamlphp/assert": "^1.0",
39+
"simplesamlphp/simplesamlphp": "^2.1",
40+
"symfony/http-foundation": "^6.4"
41+
},
42+
"require-dev": {
43+
"simplesamlphp/simplesamlphp-test-framework": "^1.5"
44+
},
45+
"support": {
46+
"issues": "https://github.com/simplesamlphp/simplesamlphp-module-authorize/issues",
47+
"source": "https://github.com/simplesamlphp/simplesamlphp-module-authorize"
48+
}
49+
}
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# authorize Module
2+
3+
* Author: Ernesto Revilla <erny@yaco.es>, Yaco Sistemas, Ryan Panning
4+
* Package: SimpleSAMLphp
5+
6+
This module provides a user authorization filter based on attribute matching
7+
for those applications that do not cleanly separate authentication from
8+
authorization and set some default permissions for authenticated users.
9+
10+
`authorize:Authorize`
11+
: Authorize certain users based on attribute matching
12+
13+
## `authorize:Authorize`
14+
15+
There are three configuration options that can be defined: `deny`, `regex`,
16+
and `reject_msg`. All other filter configuration options are considered
17+
attribute matching rules.
18+
19+
Unauthorized users will be shown a 403 Forbidden page.
20+
21+
### `deny`
22+
23+
The default action of the filter is to authorize only if an attribute match
24+
is found (default allow). When set to TRUE, this option reverses that rule and
25+
authorizes the user unless an attribute match is found (default deny), causing
26+
an unauthorized action.
27+
28+
**Note**: This option needs to be boolean (TRUE/FALSE) else it will be considered
29+
an attribute matching rule.
30+
31+
### `regex`
32+
33+
Turn regex pattern matching on or off for the attribute values defined. For
34+
backwards compatibility, this option defaults to TRUE, but can be turned off
35+
by setting it to FALSE.
36+
37+
**Note**: This option needs to be boolean (TRUE/FALSE) else it will be
38+
considered an attribute matching rule.
39+
40+
### `reject_msg`
41+
42+
This option can be used to provide a localised, custom message to an
43+
unauthorised user. For example: tailored instructions on how to fix the
44+
authorisation issue, specific contact details, etc.
45+
46+
It should be an array of key/value pairs, with the keys as the language code.
47+
You can use HTML in the message. See below for an example.
48+
49+
### `errorURL`
50+
51+
If the identity provider includes an `errorURL` in metadata, this option turns
52+
on or off the generation of a context-specific errorURL in accordance with the
53+
REFEDS SAML2 Metadata Deployment Profile for errorURL. Defaults to TRUE.
54+
55+
**Note**: This option needs to be boolean (TRUE/FALSE) else it will be
56+
considered an attribute matching rule.
57+
58+
### `allow_reauthentication`
59+
60+
This option can be used to allow users to re-authenticate if they are
61+
unauthorized. If set to TRUE, the user will be shown a button to re-authenticate.
62+
If set to FALSE, the user will not be shown a button to re-authenticate.
63+
64+
**Note**: This option needs to be boolean (TRUE/FALSE) else it will be
65+
considered FALSE.
66+
67+
### `show_user_attribute`
68+
69+
This option can be used to show the user attribute, to inform the with which
70+
account they are logged in. If set to a valid attribute, the user will see
71+
the first value of that attribute.
72+
73+
**Note**: This option needs to be a string else it will be considered disabled.
74+
Default value is NULL.
75+
76+
## Attribute Rules
77+
78+
Each additional filter configuration option is considered an attribute matching
79+
rule. For each attribute, you can specify a string or array of strings to match.
80+
If one of those attributes match one of the rules (OR operator), the user is
81+
authorized/unauthorized (depending on the deny config option).
82+
83+
**Note**: If regex is enabled, you must use the preg_match format, i.e. you have
84+
to enclose it with a delimiter that does not appear inside the regex
85+
(e.g. slash (/), at sign (@), number sign (#) or underscore (`_`)).
86+
87+
### Problems
88+
89+
* Once you get the forbidden page, you can't logout at the IdP directly,
90+
(as far as I know), you have to close the browser.
91+
92+
### Examples
93+
94+
To use this filter configure it in `config/config.php`.
95+
For unstructured attributes use `^` and `$` to anchor your regex as necessary:
96+
97+
```php
98+
'authproc.sp' => [
99+
60 => [
100+
'class' => 'authorize:Authorize',
101+
'uid' => [
102+
'/^.*@example.com$/',
103+
/*
104+
* Use anchors to prevent matching
105+
* 'wronguser1@example.edu.attacker.com'
106+
*/
107+
'/^(user1|user2|user3)@example.edu$/',
108+
],
109+
'schacUserStatus' => '@urn:mace:terena.org:userStatus:' .
110+
'example.org:service:active.*@',
111+
]
112+
]
113+
```
114+
115+
An alternate way of using this filter is to deny certain users. Or even use
116+
multiple filters to create a simple ACL, by first allowing a group of users but
117+
then denying a "black list" of users.
118+
119+
```php
120+
'authproc.sp' => [
121+
60 => array[
122+
'class' => 'authorize:Authorize',
123+
'deny' => true,
124+
'uid' => [
125+
'/.*@students.example.edu$/',
126+
'/^(stu1|stu2|stu3)@example.edu$/',
127+
]
128+
]
129+
]
130+
```
131+
132+
The regex pattern matching can be turned off, allowing for exact attribute
133+
matching rules. This can be helpful in cases where you know what the value
134+
should be. An example of this is with the memberOf attribute or using the
135+
ldap:AttributeAddUsersGroups filter with the group attribute.
136+
137+
Additionally, some helpful instructions are shown.
138+
139+
```php
140+
'authproc.sp' => [
141+
60 => [
142+
'class' => 'authorize:Authorize',
143+
'regex' => false,
144+
'group' => [
145+
'CN=SimpleSAML Students,CN=Users,DC=example,DC=edu',
146+
'CN=All Teachers,OU=Staff,DC=example,DC=edu',
147+
],
148+
'reject_msg' => [
149+
'en' => 'This service is only available to students and' .
150+
' teachers. Please contact ' .
151+
'<a href="mailto:support@example.edu">support</a>.',
152+
'nl' => 'Deze dienst is alleen beschikbaar voor studenten en ' .
153+
'docenten. Neem contact op met ' .
154+
'<a href="mailto:support@example.edu">support</a>.',
155+
],
156+
],
157+
],
158+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
#, fuzzy
3+
msgid ""
4+
msgstr ""
5+
"Project-Id-Version: SimpleSAMLphp 1.15\n"
6+
"Report-Msgid-Bugs-To: simplesamlphp-translation@googlegroups.com\n"
7+
"POT-Creation-Date: 2016-10-12 09:23+0200\n"
8+
"PO-Revision-Date: 2016-10-14 12:14+0200\n"
9+
"Last-Translator: \n"
10+
"Language: af\n"
11+
"Language-Team: \n"
12+
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=utf-8\n"
15+
"Content-Transfer-Encoding: 8bit\n"
16+
"Generated-By: Babel 2.3.4\n"
17+
18+
msgid "Access forbidden"
19+
msgstr "Toegang verbode"
20+
21+
msgid ""
22+
"You don't have the needed privileges to access this application. Please "
23+
"contact the administrator if you find this to be incorrect."
24+
msgstr ""
25+
"Jy het nie die nodige regte vir toegang na die aansoek nie. Kontak "
26+
"asseblief die administrateur indien dit inkorrek is."
27+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
#, fuzzy
3+
msgid ""
4+
msgstr ""
5+
"Project-Id-Version: SimpleSAMLphp 1.15\n"
6+
"Report-Msgid-Bugs-To: simplesamlphp-translation@googlegroups.com\n"
7+
"POT-Creation-Date: 2016-10-12 09:23+0200\n"
8+
"PO-Revision-Date: 2016-10-14 12:14+0200\n"
9+
"Last-Translator: \n"
10+
"Language: ar\n"
11+
"Language-Team: \n"
12+
"Plural-Forms: nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n>=3 "
13+
"&& n<=10 ? 3 : n>=11 && n<=99 ? 4 : 5)\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=utf-8\n"
16+
"Content-Transfer-Encoding: 8bit\n"
17+
"Generated-By: Babel 2.3.4\n"
18+
19+
msgid "Access forbidden"
20+
msgstr "ممنوع الدخول"
21+
22+
msgid ""
23+
"You don't have the needed privileges to access this application. Please "
24+
"contact the administrator if you find this to be incorrect."
25+
msgstr ""
26+
"لا يمكنك الدخول لهذا التطبيق. قم بأخطار إدارة الموقع ان كنت تظن ان هذا "
27+
"غير صحيح"
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
#, fuzzy
3+
msgid ""
4+
msgstr ""
5+
"Project-Id-Version: SimpleSAMLphp 1.15\n"
6+
"Report-Msgid-Bugs-To: simplesamlphp-translation@googlegroups.com\n"
7+
"POT-Creation-Date: 2016-10-12 09:23+0200\n"
8+
"PO-Revision-Date: 2016-10-14 12:14+0200\n"
9+
"Last-Translator: \n"
10+
"Language: cs\n"
11+
"Language-Team: \n"
12+
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
13+
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=utf-8\n"
16+
"Content-Transfer-Encoding: 8bit\n"
17+
"Generated-By: Babel 2.3.4\n"
18+
19+
msgid "Access forbidden"
20+
msgstr "Přístup odmítnut"
21+
22+
msgid ""
23+
"You don't have the needed privileges to access this application. Please "
24+
"contact the administrator if you find this to be incorrect."
25+
msgstr ""
26+
"Nemáte dostatečná práva pro přístup k této aplikaci. Prosím, kontaktujte "
27+
"administrátora, pokud toto omezení shledáváte nesprávné."
28+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
#, fuzzy
3+
msgid ""
4+
msgstr ""
5+
"Project-Id-Version: SimpleSAMLphp 1.15\n"
6+
"Report-Msgid-Bugs-To: simplesamlphp-translation@googlegroups.com\n"
7+
"POT-Creation-Date: 2016-10-12 09:23+0200\n"
8+
"PO-Revision-Date: 2016-10-14 12:14+0200\n"
9+
"Last-Translator: \n"
10+
"Language: da\n"
11+
"Language-Team: \n"
12+
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=utf-8\n"
15+
"Content-Transfer-Encoding: 8bit\n"
16+
"Generated-By: Babel 2.3.4\n"
17+
18+
msgid "Access forbidden"
19+
msgstr "Adgang forbudt"
20+
21+
msgid ""
22+
"You don't have the needed privileges to access this application. Please "
23+
"contact the administrator if you find this to be incorrect."
24+
msgstr ""
25+
"Du har ikke de nødvendige privilegier til at tilgå applikationen. Kontakt"
26+
" administratoren hvis du mener at dette ikke er korrekt."
27+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
#, fuzzy
3+
msgid ""
4+
msgstr ""
5+
"Project-Id-Version: SimpleSAMLphp 1.15\n"
6+
"Report-Msgid-Bugs-To: simplesamlphp-translation@googlegroups.com\n"
7+
"POT-Creation-Date: 2016-10-12 09:23+0200\n"
8+
"PO-Revision-Date: 2016-10-14 12:14+0200\n"
9+
"Last-Translator: \n"
10+
"Language: de\n"
11+
"Language-Team: \n"
12+
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=utf-8\n"
15+
"Content-Transfer-Encoding: 8bit\n"
16+
"Generated-By: Babel 2.3.4\n"
17+
18+
msgid "Access forbidden"
19+
msgstr "Zugriff verboten"
20+
21+
msgid ""
22+
"You don't have the needed privileges to access this application. Please "
23+
"contact the administrator if you find this to be incorrect."
24+
msgstr ""
25+
"Sie haben nicht die erforderlichen Berechtigungen um auf diese Anwendung "
26+
"zuzugreifen. Bitte kontaktieren Sie einen Administrator, wenn Sie dies "
27+
"ungerechtfertigt finden."
28+

0 commit comments

Comments
 (0)