ruby_certisign_login_custom 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/ruby_certisign_login_custom/engine.rb +5 -0
- data/lib/ruby_certisign_login_custom/helpers/certisign_form_helper.rb +26 -0
- data/lib/ruby_certisign_login_custom/version.rb +3 -0
- data/lib/ruby_certisign_login_custom.rb +37 -0
- data/ruby_certisign_login_custom.gemspec +39 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8198e111d681c774083ffe9516fc9cc04984c89051a3dfde031967c420936233
|
4
|
+
data.tar.gz: fb04e636470d0a6e2ae8986173b630f4601b879e8c614191045ed123d626cd71
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dcf5f58a9416460d84cb2c653873f5d59c963dc1c5497a96c0a0e6f8938513d637b3da90a96e86586f41d6fa3efb3b86ab5898305c591d865e572bb9c814eb6e
|
7
|
+
data.tar.gz: 50549eb406ab3574c32044d17c8b5a6ab2ef5b2e705416b141a3ac8163629adcac0cfd1f0b007625d032944a7e2e68d6b68feeb32081016becc30d75e7c9ae77
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
module CertisignFormHelper
|
3
|
+
|
4
|
+
module ActionView
|
5
|
+
|
6
|
+
CERTISIGN_LOGO = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAETgAABE4BQouT/AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAgISURBVFiFtZl5kFTFHcc/3a/fm5md2cXswoIK4mJQVEQTQwXW5RA8EiOURmKQGFOUiBg8UrDLZaIpKlHksEQjgkJpkvLAWCpHjBQREyxMGTApl0tBCJpQIuxyzbXzju78scuyC7PMzgz7/etVd/9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WLoUVGmP75ra2be2AI0/67ztN/pJTDdW5VyJCpZhUI7GfrMakGoj//kZ0/KsugwWwm4KnIwv8dndsp1Vr0QXB/XZGb2rbJlqum0KDJ6OPfUn8xdHoY//rWtiM3hRb4P/i1PasZZMBmZhpb/XC8jIALJvIiDkYN0Xmn8916TRoga0vneddma0v14X2B15EVncd2umym/TG0ie8ER31d1jAC9Cl871rQin/GWGKr5lzSRiMkwoWnwm2hSu30tPUaC8kVvqOrDg7eO2lfN1gu2bcqQssm/L97DXPDckHtRKRwvFOSvom7bh68Ymbyc6osA+L09WswJGTA1v0LeTDouWafdLXS2ML/SfyjV/UiTk+hUoRUxONEmOMEP2MpFxL4RiJwDTPS2mMKwKOiMB8LrRZq42/omwRDbm9Z9f/AaZmMu6i9stGAAAAAElFTkSuQmCC"
|
7
|
+
|
8
|
+
def certisign_form(id, name, url, method = :get)
|
9
|
+
menu = content_tag(:form, action: "https://autenticador.certisign.com.br/CertisignLogin/certificado/login", method: method) do
|
10
|
+
concat hidden_field_tag :id, id
|
11
|
+
concat hidden_field_tag :nome, name
|
12
|
+
concat hidden_field_tag :retorno, url
|
13
|
+
concat tag :br
|
14
|
+
concat content_tag(:button, type: :submit, class: "btn btn-default btn-block btn-certisign") do
|
15
|
+
concat content_tag(:img, nil, src: CERTISIGN_LOGO, style: 'float: left; width: 30px')
|
16
|
+
concat "Login com Certificado Digital"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
ActionView::Base.send :include, CertisignFormHelper::ActionView
|
26
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "ruby_certisign_login_custom/version"
|
2
|
+
require 'ruby_certisign_login_custom/engine'
|
3
|
+
require 'ruby_certisign_login_custom/helpers/certisign_form_helper'
|
4
|
+
|
5
|
+
module RubyCertisignLoginCustom
|
6
|
+
class Decrypt
|
7
|
+
# CHAVE criada no site da CertiSignLogin
|
8
|
+
CERTISIGN_KEYPATH = File.join(Dir.getwd, "config", "keys", "certisign.pk")
|
9
|
+
|
10
|
+
# string: valor recebido como valor da chave 'cb' da requisição de certificado (params['cb'])
|
11
|
+
def self.decrypt(string)
|
12
|
+
# Recusar erros padrões como certificado não encontrado
|
13
|
+
return string if string.size < 128
|
14
|
+
valid_key?
|
15
|
+
|
16
|
+
# Instanciar e configurar algoritmo
|
17
|
+
decipher = OpenSSL::Cipher::AES.new(128, :CBC)
|
18
|
+
decipher.decrypt
|
19
|
+
decipher.key = File.read(CERTISIGN_KEYPATH).slice(0,16)
|
20
|
+
#decipher.iv = 16
|
21
|
+
|
22
|
+
string_decoded = Base64.decode64(string.gsub("certplus", "\\\\+"))
|
23
|
+
decrypt = decipher.update(string_decoded) + decipher.final
|
24
|
+
eval decrypt.slice( decrypt.index('{'), 999999)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.valid_key?
|
28
|
+
unless File.exist?(CERTISIGN_KEYPATH)
|
29
|
+
raise "Adicione sua chave em #{CERTISIGN_KEYPATH}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.cert_valid?(hash)
|
35
|
+
hash[:valido] && hash[:validade].to_date >= Date.today
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "ruby_certisign_login_custom/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "ruby_certisign_login_custom"
|
9
|
+
spec.version = RubyCertisignLoginCustom::VERSION
|
10
|
+
spec.platform = Gem::Platform::RUBY
|
11
|
+
spec.authors = ["Gabriel Rocha"]
|
12
|
+
spec.email = ["gabrielras12@hotmail.com"]
|
13
|
+
spec.summary = "Versão em ruby para autenticação via CertiSignLogin."
|
14
|
+
spec.description = "A Gem possui um helper para gerar o formulario que envia o request de certificados a CertiSign e uma rotina para descriptografar o retorno recebido da CertiSign."
|
15
|
+
spec.homepage = "http://www.mondriantecnologia.com"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
19
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
20
|
+
#if spec.respond_to?(:metadata)
|
21
|
+
# spec.metadata["allowed_push_host"] = "*"
|
22
|
+
#else
|
23
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
+
# "public gem pushes."
|
25
|
+
#end
|
26
|
+
|
27
|
+
# Specify which files should be added to the gem when it is released.
|
28
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
|
+
spec.files = Dir["lib/ruby_certisign_login_custom.rb", "lib/ruby_certisign_login_custom/engine.rb", "lib/ruby_certisign_login_custom/helpers/certisign_form_helper.rb", "lib/ruby_certisign_login_custom/version.rb", "ruby_certisign_login_custom.gemspec"]
|
30
|
+
|
31
|
+
spec.bindir = "exe"
|
32
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ["lib"]
|
34
|
+
|
35
|
+
spec.add_runtime_dependency 'railties', '>= 7.0', '< 8.0'
|
36
|
+
|
37
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
38
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby_certisign_login_custom
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gabriel Rocha
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-01-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '7.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '8.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '7.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '8.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '2.0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '13.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '13.0'
|
61
|
+
description: A Gem possui um helper para gerar o formulario que envia o request de
|
62
|
+
certificados a CertiSign e uma rotina para descriptografar o retorno recebido da
|
63
|
+
CertiSign.
|
64
|
+
email:
|
65
|
+
- gabrielras12@hotmail.com
|
66
|
+
executables: []
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- lib/ruby_certisign_login_custom.rb
|
71
|
+
- lib/ruby_certisign_login_custom/engine.rb
|
72
|
+
- lib/ruby_certisign_login_custom/helpers/certisign_form_helper.rb
|
73
|
+
- lib/ruby_certisign_login_custom/version.rb
|
74
|
+
- ruby_certisign_login_custom.gemspec
|
75
|
+
homepage: http://www.mondriantecnologia.com
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubygems_version: 3.3.7
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Versão em ruby para autenticação via CertiSignLogin.
|
98
|
+
test_files: []
|