VIISP::Auth
Lithuanian E-Government Gateway "Elektroniniai valdžios vartai" identity service client.
VIISP identity service documentation: https://www.epaslaugos.lt/portal/content/1257
Installation
Add this line to your application's Gemfile:
gem 'viisp-auth'
Configuration
VIISP::Auth.configure do |c|
c.pid = '1234'
c.private_key = OpenSSL::PKey::RSA.new(File.read('your-private-key.pem'))
c.postback_url = 'https://localhost'
c.providers = %w[auth.lt.identity.card auth.lt.bank]
c.attributes = %w[lt-personal-code lt-company-code]
c.user_information = %w[firstName lastName companyName email]
c.test = true
end
Usage
Get an authentication ticket:
ticket = VIISP::Auth.ticket
Redirected user to authentication portal with ticket using http POST.
VIISP::Auth.portal_endpoint
is a convenience method to get portal URL.
Redirect form for testing: https://jsfiddle.net/kmrzpqwk/
After successful authentication identity data can be fetched once.
identity = VIISP::Auth.identity(
ticket: ticket,
include_source_data: true,
)
Identity example:
{
"authentication_provider" => "auth.lt.bank",
"attributes" => {
"lt-personal-code" => "XXXXXXXXXXX"
},
"user_information" => {
"firstName" => "VARDENIS",
"lastName" => "PAVARDENIS",
"companyName" => nil
},
"custom_data" => "correlation-123",
"source_data" => {
"type" => "BANKLINK",
"parameters" => {
"VK_USER" => "12345678900",
"VK_TIME" => "08:57:29"
}
}
}
Ticket arguments
You can pass custom_data
and override some configuration attributes when requesting ticket.
ticket = VIISP::Auth.ticket(
custom_data: 'custom data',
postback_url: 'https://localhost',
providers: %w[auth.lt.identity.card auth.lt.bank],
attributes: %w[lt-personal-code lt-company-code],
user_information: %w[firstName lastName companyName email],
)
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/laurynas/viisp-auth. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the VIISP::Auth project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.