@@ -36,22 +36,36 @@ Add to your `routes.rb` file, for example:
36
36
get ' /saml/auth' => ' saml_idp#new'
37
37
get ' /saml/metadata' => ' saml_idp#show'
38
38
post ' /saml/auth' => ' saml_idp#create'
39
+ match ' /saml/logout' => ' saml_idp#logout' , via: [:get , :post , :delete ]
39
40
```
40
41
41
42
Create a controller that looks like this, customize to your own situation:
42
43
43
44
``` ruby
44
- class SamlIdpController < SamlIdp ::IdpController
45
+ class SamlIdpController
46
+ include SamlIdp ::IdpController
47
+
45
48
def idp_authenticate (email , password ) # not using params intentionally
46
49
user = User .by_email(email).first
47
50
user && user.valid_password?(password) ? user : nil
48
51
end
49
52
private :idp_authenticate
50
53
51
54
def idp_make_saml_response (found_user ) # not using params intentionally
52
- encode_response found_user
55
+ # NOTE encryption is optional
56
+ encode_response found_user, encryption: {
57
+ cert: saml_request.service_provider.cert,
58
+ block_encryption: ' aes256-cbc' ,
59
+ key_transport: ' rsa-oaep-mgf1p'
60
+ }
53
61
end
54
62
private :idp_make_saml_response
63
+
64
+ def idp_logout
65
+ user = User .by_email(saml_request.name_id)
66
+ user.logout
67
+ end
68
+ private :idp_logout
55
69
end
56
70
` ` `
57
71
0 commit comments