omniauth-ldap 1.0.5 → 2.3.1
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +202 -0
- data/CITATION.cff +20 -0
- data/CODE_OF_CONDUCT.md +134 -0
- data/CONTRIBUTING.md +213 -0
- data/FUNDING.md +66 -0
- data/LICENSE.txt +23 -0
- data/README.md +813 -67
- data/REEK +0 -0
- data/RUBOCOP.md +71 -0
- data/SECURITY.md +21 -0
- data/lib/omniauth/strategies/ldap.rb +159 -53
- data/lib/omniauth-ldap/adaptor.rb +162 -54
- data/lib/omniauth-ldap/version.rb +4 -1
- data/lib/omniauth-ldap.rb +6 -1
- data/sig/omniauth/ldap/adaptor.rbs +54 -0
- data/sig/omniauth/ldap/version.rbs +11 -0
- data/sig/omniauth/strategies/ldap.rbs +32 -0
- data/sig/omniauth-ldap.rbs +5 -0
- data/sig/rbs/net-ldap.rbs +19 -0
- data/sig/rbs/net-ntlm.rbs +16 -0
- data/sig/rbs/sasl.rbs +12 -0
- data.tar.gz.sig +0 -0
- metadata +334 -95
- metadata.gz.sig +0 -0
- data/.gitignore +0 -3
- data/.rspec +0 -1
- data/Gemfile +0 -11
- data/Guardfile +0 -11
- data/Rakefile +0 -9
- data/omniauth-ldap.gemspec +0 -28
- data/spec/omniauth/strategies/ldap_spec.rb +0 -194
- data/spec/omniauth-ldap/adaptor_spec.rb +0 -82
- data/spec/spec_helper.rb +0 -14
data/lib/omniauth-ldap.rb
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module OmniAuth
|
|
2
|
+
module LDAP
|
|
3
|
+
class Adaptor
|
|
4
|
+
class LdapError < ::StandardError
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class ConfigurationError < ::StandardError
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class AuthenticationError < ::StandardError
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class ConnectionError < ::StandardError
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
VALID_ADAPTER_CONFIGURATION_KEYS: Array[Symbol]
|
|
17
|
+
MUST_HAVE_KEYS: Array[untyped]
|
|
18
|
+
METHOD: Hash[Symbol, Symbol?]
|
|
19
|
+
|
|
20
|
+
attr_accessor bind_dn: String?
|
|
21
|
+
attr_accessor password: String?
|
|
22
|
+
|
|
23
|
+
# Net::LDAP is provided by the net-ldap gem; we reference it here for clarity.
|
|
24
|
+
attr_reader connection: Net::LDAP
|
|
25
|
+
attr_reader uid: String?
|
|
26
|
+
attr_reader base: String?
|
|
27
|
+
# auth is the hash passed to Net::LDAP#auth or similar
|
|
28
|
+
attr_reader auth: Hash[Symbol, untyped]
|
|
29
|
+
# filter is an LDAP filter string when configured
|
|
30
|
+
attr_reader filter: String?
|
|
31
|
+
|
|
32
|
+
# Validate that required keys exist in the configuration
|
|
33
|
+
def self.validate: (?Hash[Symbol, untyped]) -> void
|
|
34
|
+
def initialize: (?Hash[Symbol, untyped]) -> void
|
|
35
|
+
|
|
36
|
+
# Perform a search and optionally bind; returns the matched entry or false
|
|
37
|
+
def bind_as: (?Hash[Symbol, untyped]) -> (Net::LDAP::Entry? | false)
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
# Returns a Net::LDAP encryption symbol (e.g. :simple_tls, :start_tls) or nil
|
|
42
|
+
def ensure_method: (untyped) -> Symbol?
|
|
43
|
+
|
|
44
|
+
# Returns an array of SASL auth hashes
|
|
45
|
+
def sasl_auths: (?Hash[Symbol, untyped]) -> Array[Hash[Symbol, untyped]]
|
|
46
|
+
|
|
47
|
+
# Returns initial credential (string) and a proc that accepts a challenge and returns the response
|
|
48
|
+
# Use Array[untyped] here to avoid tuple syntax issues in some linters; the runtime value
|
|
49
|
+
# is commonly a two-element array [initial_credential, proc].
|
|
50
|
+
def sasl_bind_setup_digest_md5: (?Hash[Symbol, untyped]) -> Array[untyped]
|
|
51
|
+
def sasl_bind_setup_gss_spnego: (?Hash[Symbol, untyped]) -> Array[untyped]
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module OmniAuth
|
|
2
|
+
module Strategies
|
|
3
|
+
class LDAP
|
|
4
|
+
OMNIAUTH_GTE_V2: bool
|
|
5
|
+
|
|
6
|
+
# CONFIG is a read-only mapping of string keys to mapping definitions
|
|
7
|
+
CONFIG: Hash[String, untyped]
|
|
8
|
+
|
|
9
|
+
# The request_phase either returns a Rack-compatible response or the form response.
|
|
10
|
+
def request_phase: () -> (Rack::Response | Array[untyped] | String)
|
|
11
|
+
|
|
12
|
+
# The callback_phase may call super (untyped) or return a failure symbol
|
|
13
|
+
def callback_phase: () -> untyped
|
|
14
|
+
|
|
15
|
+
# Accepts an adaptor and returns a Net::LDAP::Filter or similar
|
|
16
|
+
# Optional second argument allows overriding the username (used for header-based SSO)
|
|
17
|
+
def filter: (OmniAuth::LDAP::Adaptor) -> Net::LDAP::Filter
|
|
18
|
+
| (OmniAuth::LDAP::Adaptor, String?) -> Net::LDAP::Filter
|
|
19
|
+
|
|
20
|
+
# Map a user object (Net::LDAP::Entry-like) into a Hash for the auth info
|
|
21
|
+
def self.map_user: (Hash[String, untyped], untyped) -> Hash[String, untyped]
|
|
22
|
+
|
|
23
|
+
def missing_credentials?: () -> bool
|
|
24
|
+
|
|
25
|
+
# Extract username from a trusted header when enabled
|
|
26
|
+
def header_username: () -> (String | nil)
|
|
27
|
+
|
|
28
|
+
# Perform a directory lookup for a given username; returns an Entry or nil
|
|
29
|
+
def directory_lookup: (OmniAuth::LDAP::Adaptor, String) -> untyped
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Minimal stubs for net-ldap types used by the gem
|
|
2
|
+
module Net
|
|
3
|
+
class LDAP
|
|
4
|
+
def initialize: (Hash[Symbol, untyped]) -> void
|
|
5
|
+
def open: () { (self) -> untyped } -> untyped
|
|
6
|
+
def search: (?Hash[Symbol, untyped]) -> Array[Net::LDAP::Entry]
|
|
7
|
+
def bind: (?Hash[Symbol, untyped]) -> bool
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class LDAP::Entry
|
|
11
|
+
def dn: () -> String
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class LDAP::Filter
|
|
15
|
+
def self.construct: (String) -> Net::LDAP::Filter
|
|
16
|
+
def self.eq: (String, String) -> Net::LDAP::Filter
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Minimal stubs for net-ntlm types used by the gem
|
|
2
|
+
module Net
|
|
3
|
+
module NTLM
|
|
4
|
+
class Message
|
|
5
|
+
def self.parse: (untyped) -> Net::NTLM::Message
|
|
6
|
+
def response: (?Hash[Symbol, untyped], ?Hash[Symbol, untyped]) -> Net::NTLM::Message
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class Message::Type1
|
|
10
|
+
def serialize: () -> String
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.encode_utf16le: (String) -> String
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
data/sig/rbs/sasl.rbs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Minimal stubs for SASL bindings used in tests
|
|
2
|
+
module SASL
|
|
3
|
+
class Preferences
|
|
4
|
+
def initialize: (?Hash[Symbol, untyped]) -> void
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class SASL
|
|
8
|
+
def initialize: (String, SASL::Preferences) -> void
|
|
9
|
+
def receive: (String, untyped) -> [untyped, untyped]
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
data.tar.gz.sig
ADDED
|
Binary file
|