Skip to content

Commit b7ee3d7

Browse files
committed
Improve readme.md
1 parent 9920d9b commit b7ee3d7

1 file changed

Lines changed: 44 additions & 11 deletions

File tree

README.md

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,37 @@ The Ruby SAML library is for implementing the client side of a SAML authorizatio
99

1010
SAML authorization is a two step process and you are expected to implement support for both.
1111

12-
## The initialization phase
12+
## Getting Started
13+
In order to use the toolkit you will need to install the gem (either manually or using Bundler), and require the library in your Ruby application:
14+
15+
Using `Gemfile`
16+
17+
```ruby
18+
# latest stable
19+
gem 'ruby-saml', '~> 0.8.1'
20+
21+
# or track master for bleeding-edge
22+
gem 'ruby-saml', git: 'onelogin/ruby-saml'
23+
```
24+
25+
Using Bundler
26+
27+
```sh
28+
gem install ruby-saml
29+
```
30+
31+
When requiring the gem, you can add the whole toolkit
32+
```ruby
33+
require 'onelogin/ruby-saml'
34+
```
35+
36+
or just the required components individually:
37+
38+
```ruby
39+
require 'onelogin/ruby-saml/authrequest'
40+
```
41+
42+
## The Initialization Phase
1343

1444
This is the first request you will get from the identity provider. It will hit your application at a specific URL (that you've announced as being your SAML initialization point). The response to this initialization, is a redirect back to the identity provider, which can look something like this (ignore the saml_settings method call for now):
1545

@@ -46,6 +76,7 @@ def saml_settings
4676
settings.idp_sso_target_url = "https://app.onelogin.com/saml/signon/#{OneLoginAppId}"
4777
settings.idp_cert_fingerprint = OneLoginAppCertFingerPrint
4878
settings.name_identifier_format = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
79+
4980
# Optional for most SAML IdPs
5081
settings.authn_context = "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
5182

@@ -84,8 +115,10 @@ class SamlController < ApplicationController
84115
settings.idp_sso_target_url = "https://app.onelogin.com/saml/signon/#{OneLoginAppId}"
85116
settings.idp_cert_fingerprint = OneLoginAppCertFingerPrint
86117
settings.name_identifier_format = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
118+
87119
# Optional for most SAML IdPs
88120
settings.authn_context = "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
121+
89122
# Optional. Describe according to IdP specification (if supported) which attributes the SP desires to receive in SAMLResponse.
90123
settings.attributes_index = 30
91124

@@ -94,7 +127,7 @@ class SamlController < ApplicationController
94127
end
95128
```
96129

97-
If are using saml:AttributeStatement to transfare metadata, like the user name, you can access all the attributes through response.attributes. It
130+
If are using saml:AttributeStatement to transfer metadata, like the user name, you can access all the attributes through response.attributes. It
98131
contains all the saml:AttributeStatement with its 'Name' as a indifferent key and the one saml:AttributeValue as value.
99132

100133
```ruby
@@ -109,8 +142,8 @@ response.attributes[:username]
109142
To form a trusted pair relationship with the IdP, the SP (you) need to provide metadata XML
110143
to the IdP for various good reasons. (Caching, certificate lookups, relaying party permissions, etc)
111144

112-
The class OneLogin::RubySaml::Metadata takes care of this by reading the Settings and returning XML. All
113-
you have to do is add a controller to return the data, then give this URL to the IdP administrator.
145+
The class `OneLogin::RubySaml::Metadata` takes care of this by reading the Settings and returning XML. All you have to do is add a controller to return the data, then give this URL to the IdP administrator.
146+
114147
The metdata will be polled by the IdP every few minutes, so updating your settings should propagate
115148
to the IdP settings.
116149

@@ -139,11 +172,11 @@ response = OneLogin::RubySaml::Response.new(params[:SAMLResponse], :allowed_cloc
139172

140173
Make sure to keep the value as comfortably small as possible to keep security risks to a minimum.
141174

142-
## Note on Patches/Pull Requests
175+
## Adding Features, Pull Requests
143176

144-
* Fork the project.
145-
* Make your feature addition or bug fix.
146-
* Add tests for it. This is important so I don't break it in a
147-
future version unintentionally.
148-
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
149-
* Send me a pull request. Bonus points for topic branches.
177+
* Fork the repository
178+
* Make your feature addition or bug fix
179+
* Add tests for your new features. This is important so we don't break any features in a future version unintentionally.
180+
* Ensure all tests pass.
181+
* Do not change rakefile, version, or history.
182+
* Open a pull request, following [this template](https://gist.github.com/Lordnibbler/11002759).

0 commit comments

Comments
 (0)