If you want to run the tests you will have add the following as well:
If you want to run the tests you will have add the following as well:
```ruby
group :test do
group :test do
gem 'rspec-steps', '~> 0.4.0'
gem 'rspec-steps', '~> 0.4.0'
end
end
```
## Configuration
## Configuration
The provider configuration can be either done in `configuration.yml` or within the settings.
The provider configuration can be either done in `configuration.yml` or within the settings.
### configuration.yml
### `configuration.yml`
Example configuration:
Example configuration:
```yaml
default:
default:
openid_connect:
openid_connect:
google:
google:
@ -36,11 +38,26 @@ Example configuration:
secret: "4z389thugh334t8h"
secret: "4z389thugh334t8h"
icon: "openid_connect/auth_provider-google.png"
icon: "openid_connect/auth_provider-google.png"
display_name: "Google"
display_name: "Google"
```
The last two attributes are commonly available for all providers. They are used to change a provider's look.
To grab corresponding values from ENV (eg. on heroku) do it this way:
```yaml
default:
...
openid_connect:
google:
identifier: <%= ENV['GOGLE_CLIENT_ID'] %>
secret: <%= ENV['GOOGLE_CLIENT_SECRET'] %>
...
```
Note that currently there are only two custom provider icons this plugin has out of the box (for supported providers):
The last two attributes are commonly available for all providers.
* `openid_connect/auth_provider-google.png`
They are used to change a provider's look.
* `openid_connect/auth_provider-heroku.png`
Note that `openid_connect/auth_provider-google.png` is the one custom provider icon this plugin has out of the box. Other icons you will have to add yourself.
Other icons you will have to add yourself. <small>FIXME: Elaborate on this a bit as it is unclear
how and where they should be added</small>
`display_name` changes a provider's label shown to the user.
`display_name` changes a provider's label shown to the user.
There is no UI for the settings just yet. One way to set them until then is the rails console:
There is no UI for the settings just yet. One way to set them until then is the rails console:
```ruby
Setting["plugin_openproject_openid_connect"] = {
Setting["plugin_openproject_openid_connect"] = {
"providers" => {
"providers" => {
"google" => {
"google" => {
@ -74,10 +91,11 @@ There is no UI for the settings just yet. One way to set them until then is the
}
}
}
}
}
}
```
While Google and Heroku are pre-defined you can add arbitrary providers through configuration.
While Google and Heroku are pre-defined you can add arbitrary providers through configuration.
Those may then require the host and/or endpoints to be specified depending on whether or not a particular provider adheres to the default endpoint paths.
Those may then require the host and/or endpoints to be specified depending on whether or not a particular provider adheres to the default endpoint paths.
```ruby
Setting["plugin_openproject_openid_connect"] = {
Setting["plugin_openproject_openid_connect"] = {
"providers" => {
"providers" => {
"myprovider" => {
"myprovider" => {
@ -102,6 +120,7 @@ Those may then require the host and/or endpoints to be specified depending on wh
}
}
}
}
}
}
```
If a host is given, relative endpoint paths will refer to said host.
If a host is given, relative endpoint paths will refer to said host.
No host is required if absolute endpoint URIs are given.
No host is required if absolute endpoint URIs are given.
@ -128,4 +147,4 @@ If you want to use a different list of CAs for validating provider SSL certifica
## Credits
## Credits
This plugin uses some of Neil Hainsworth' [Free Social Icons](http://www.neilorangepeel.com/free-social-icons/).
This plugin uses some of [Social Icons](https://github.com/yukoff/social-icons).
<arel="license"href="http://creativecommons.org/licenses/by-sa/4.0/"><imgalt="Creative Commons License"style="border-width:0"src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png"/></a><br/><spanxmlns:dct="http://purl.org/dc/terms/"property="dct:title">Social Icons</span> by <axmlns:cc="http://creativecommons.org/ns#"href="https://github.com/yukoff/social-icons"property="cc:attributionName"rel="cc:attributionURL">yukoff</a> is licensed under a <arel="license"href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.