net-smtp-auth_ntlm 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +17 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +29 -0
- data/Rakefile +12 -0
- data/lib/net/smtp/auth_ntlm.rb +36 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6ce696c2d65e7cd0cc4730af1859e57ed0af3c7e6f07e87ad5a68eaf8cae9e3f
|
4
|
+
data.tar.gz: ae98072350cd697a0f27c04cd901484b68eb1bed71111565d41a73073f06529b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a53b162c674d7f560172a52d7180c9ca183e01dae6104c5368af4b1fb005dd78d70dea27d5841a300e79e7744d55b819006dc93777d48aa28cebb04224822a7c
|
7
|
+
data.tar.gz: fc9ed4c33a6d611d19becb8ba2b5ce32c4414cc88f6364c9d1e8ec2074ccc867d4e5538908647b0cd67352faac401b7e9430e27e89a9a424ad1e8164176d122d
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.7
|
3
|
+
SuggestExtensions: false
|
4
|
+
NewCops: enable
|
5
|
+
|
6
|
+
Style/StringLiterals:
|
7
|
+
EnforcedStyle: double_quotes
|
8
|
+
|
9
|
+
Style/StringLiteralsInInterpolation:
|
10
|
+
EnforcedStyle: double_quotes
|
11
|
+
|
12
|
+
# Do it the same way net/smtp does
|
13
|
+
Style/ClassAndModuleChildren:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Metrics/BlockLength:
|
17
|
+
Max: 40
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Anton Baklanov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Net::SMTP::AuthNTLM
|
2
|
+
|
3
|
+
`Net::SMTP::Authenticator` implementation for NTLM authentication based on [rubyntlm](https://github.com/WinRb/rubyntlm) gem.
|
4
|
+
|
5
|
+
Does the same thing as [ruby-ntlm](https://github.com/macks/ruby-ntlm) gem but works out of the box with modern `net-smtp` (fixes https://github.com/macks/ruby-ntlm/issues/10) and `openssl` (fixes https://github.com/macks/ruby-ntlm/issues/9).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Just add it to your Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem "net-smtp-auth_ntlm"
|
13
|
+
````
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require "net/smtp/auth_ntlm"
|
19
|
+
```
|
20
|
+
|
21
|
+
And you can use `:ntlm` as authtype in `Net::SMTP.start` or your mailer configuration.
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/bak1an/net-smtp-auth_ntlm.
|
26
|
+
|
27
|
+
## License
|
28
|
+
|
29
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "net/smtp"
|
4
|
+
require "rubyntlm"
|
5
|
+
|
6
|
+
class Net::SMTP
|
7
|
+
# Provides NTLM authentication for Net::SMTP.
|
8
|
+
# based on example from https://github.com/WinRb/rubyntlm/blob/master/examples/smtp.rb and
|
9
|
+
# old Net::SMTP NTLM implementation from https://github.com/macks/ruby-ntlm/blob/master/lib/ntlm/smtp.rb
|
10
|
+
class AuthNTLM < Net::SMTP::Authenticator
|
11
|
+
auth_type :ntlm
|
12
|
+
|
13
|
+
def auth(user, secret)
|
14
|
+
raise Net::SMTPAuthenticationError, "NTLM not supported" unless smtp.auth_capable?("NTLM")
|
15
|
+
|
16
|
+
domain, user = if user.index("\\")
|
17
|
+
user.split("\\", 2)
|
18
|
+
else
|
19
|
+
["", user]
|
20
|
+
end
|
21
|
+
|
22
|
+
perform_auth(user, domain, secret)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def perform_auth(user, domain, password)
|
28
|
+
t1 = Net::NTLM::Message::Type1.new
|
29
|
+
challenge = continue("AUTH NTLM #{t1.encode64}")
|
30
|
+
t2 = Net::NTLM::Message.decode64(challenge)
|
31
|
+
t3 = t2.response({ user: user, password: password, domain: domain }, {})
|
32
|
+
|
33
|
+
finish(t3.encode64)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: net-smtp-auth_ntlm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anton Baklanov
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-10-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: net-smtp
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubyntlm
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.6'
|
41
|
+
description: NTLM auth adapter for Net::SMTP using rubyntlm gem.
|
42
|
+
email:
|
43
|
+
- antonbaklanov@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".rspec"
|
49
|
+
- ".rubocop.yml"
|
50
|
+
- CHANGELOG.md
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/net/smtp/auth_ntlm.rb
|
55
|
+
homepage: https://github.com/bak1an/net-smtp-auth_ntlm
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata:
|
59
|
+
homepage_uri: https://github.com/bak1an/net-smtp-auth_ntlm
|
60
|
+
source_code_uri: https://github.com/bak1an/net-smtp-auth_ntlm
|
61
|
+
changelog_uri: https://github.com/bak1an/net-smtp-auth_ntlm/blob/main/CHANGELOG.md
|
62
|
+
rubygems_mfa_required: 'true'
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 2.7.0
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubygems_version: 3.5.9
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: NTLM auth for Net::SMTP
|
82
|
+
test_files: []
|