|
| 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 commit comments