Omniauth Swedbank
Omniauth strategy for using Swedbank as an authentication service provider.
Supported Ruby versions: 2.7+
Related projects
- omniauth-citadele - strategy for authenticating with Citadele
- omniauth-dnb - strategy for authenticating with DNB
- omniauth-nordea - strategy for authenticating with Nordea
- omniauth-seb-elink - strategy for authenticating with SEB
Installation
Add these lines to your application's Gemfile (omniauth-rails_csrf_protection is required if using Rails):
gem 'omniauth-rails_csrf_protection'
gem 'omniauth-swedbank'
And then execute:
$ bundle
Or install it yourself as:
$ gem install omniauth-rails_csrf_protection omniauth-swedbank
Usage
Here's a quick example, adding the middleware to a Rails app
in config/initializers/omniauth.rb
:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :swedbank,
File.read("path/to/private.key"),
File.read("path/to/bank.crt"),
ENV['SWEDBANK_SND_ID'],
ENV['SWEDBANK_REC_ID']
end
Auth Hash
Here's an example Auth Hash available in request.env['omniauth.auth']
:
{
provider: 'swedbank',
uid: '374042-80367',
info: {
full_name: 'ARNIS RAITUMS'
},
extra: {
raw_info: {
VK_SERVICE: '3003',
VK_VERSION: '008',
VK_SND_ID: 'HP',
VK_REC_ID: 'MPLMT',
VK_NONCE: '20170425114529204413',
VK_INFO: 'ISIK:090482-12549;NIMI:DACE ĀBOLA',
VK_MAC: 'qrEMRf6YV...',
VK_ENCODING: 'UTF-8
}
}
}
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request