You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changed the sp setup so we don't need a base 64 encoded value.
Verfiy sp signatures if certificates are passed in
Made installation a little easier and updated the README.md
Removed EncodeAssertionUrlCommand.php as we now use actual urls.
@@ -113,18 +55,55 @@ Within ```config/filesystem.php``` following entry needs to be added:
113
55
],
114
56
```
115
57
116
-
The package controllers are using the ```storage/saml``` path for retrieving both certificates and the metadata file. Create first the storage path, then either add or link the certificates. Add also a metadata file for the SAML IDP. For help generating an IDP metadata.xml file, see https://www.samltool.com/idp_metadata.php.
58
+
#### Setting the entity id
117
59
60
+
In config/saml.php set the field idp.entity-id to your entity id. This is normally a uri, the uri doesn't need to exist, it just needs to be unique
61
+
62
+
'idp' => [
63
+
.....
64
+
'entityId' => 'http://idp.wherever.com'
65
+
],
66
+
67
+
#### Generating metadata and certificates
68
+
69
+
There is a sample metadata template in storage/saml/idp/metadata.blade.php, This was generated using https://www.samltool.com/idp_metadata.php
70
+
71
+
Edit this template to customize it for your site.
72
+
73
+
When you're finished run the following command to generate certificates and the metadata file
Add the contents to the metadata.xml, cert.pem and key.pem files for the IDP.
94
+
//A nifty testing service provider
95
+
'https://sptest.iamshowcase.com/acs' => [
96
+
97
+
]
98
+
99
+
],
100
+
```
124
101
125
102
### Using the SAML package
126
103
127
-
To use the SAML package, some files need to be modified. Within your login view, problably ```resources/views/auth/login.blade.php``` add a SAMLRequest field beneath the CSRF field (this is actually a good place for it):
104
+
To use the SAML package, some files need to be modified.
105
+
Within your login view, problably ```resources/views/auth/login.blade.php``` add a SAMLRequest field beneath the CSRF field
106
+
(this is actually a good place for it):
128
107
```
129
108
{{-- The hidden CSRF field for secure authentication --}}
130
109
{{ csrf_field() }}
@@ -134,37 +113,24 @@ To use the SAML package, some files need to be modified. Within your login view,
134
113
@endif
135
114
```
136
115
137
-
The SAMLRequest field will be filled automatically when a SAMLRequest is sent by a http request and therefore initiate a SAML authentication attempt. To initiate the SAML auth, the login and redirect functions need to be modified. Within ```app/Http/Middleware/AuthenticatesUsers.php``` add following lines to both the top and the authenticated function:
138
-
(NOTE: you might need to copy it out from vendor/laravel/framework/src/Illuminate/Foundation/Auth/ to your Middleware directory)
139
-
116
+
The SAMLRequest field will be filled automatically when a SAMLRequest is sent by a http request and therefore initiate a SAML authentication attempt.
117
+
To initiate the SAML auth, the login and redirect functions need to be modified.
118
+
Within ```app/Http/Controllers/Auth/LoginController.php``` change ```use AuthenticatesUsers``` to ```use SamlAuthenticatesUsers```
119
+
140
120
```
141
-
<?php
142
-
143
-
namespace App\Http\Middleware;
144
-
145
-
use Illuminate\Http\Request;
146
-
use Illuminate\Support\Facades\Auth;
147
-
use Illuminate\Foundation\Auth\RedirectsUsers;
148
-
use Illuminate\Foundation\Auth\ThrottlesLogins;
149
-
150
-
use KingStarter\LaravelSaml\Http\Traits\SamlAuth;
121
+
use App\Http\Controllers\Controller;
122
+
use KingStarter\LaravelSaml\Http\Traits\SamlAuthenticatesUsers;
151
123
152
-
trait AuthenticatesUsers
124
+
class LoginController extends Controller
153
125
{
154
-
use RedirectsUsers, ThrottlesLogins, SamlAuth;
155
-
156
-
...
126
+
...
157
127
158
-
protected function authenticated(Request $request, $user)
To allow later direct redirection when somebody is already logged in, we need to add also some lines to ```app/Http/Middleware/RedirectIfAuthenticated.php```:
169
135
```
170
136
<?php
@@ -201,19 +167,29 @@ class RedirectIfAuthenticated
201
167
}
202
168
```
203
169
204
-
## SAML Service Providers (SPs)
205
170
206
-
To add one or more service providers, go to the ```config/saml.php``` configuration file and scroll down to the 'sp' array. Having the Login-Address of the SAML-SP, add another entry. For reasons of internal interpretation, the URL needs to be Base64 encoded.
171
+
### bindings:HTTP-POST
207
172
208
-
### Debugging SP entries
173
+
If you're using HTTP post bindings then you'll need to allow saml to get the login request via post.
209
174
210
-
In case that there are some problems receiving the Base64 string or evaluating SAML authentication requests in general, it is possible to use the debugger setting ```saml.debug_saml_request``` within the config file.
You can enable logging with the config/saml.php setting debug_saml_request
211
188
212
189
```
213
190
// Allow debugging within SamlAuth trait to get SP data
214
191
// during SAML authentication request
215
192
'debug_saml_request' => true,
216
193
```
217
194
218
-
Make sure that the environmental logging variable ```APP_LOG_LEVEL``` is set to debug within your ```.env``` file.
219
-
195
+
Make sure that the environmental logging variable ```APP_LOG_LEVEL``` is set to debug within your ```.env``` file. It will log to ```storage/logs/laravel.log```
0 commit comments