Class: ROM::LDAP::PDU Private
- Inherits:
-
Object
- Object
- ROM::LDAP::PDU
- Extended by:
- Initializer
- Defined in:
- lib/rom/ldap/pdu.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
LDAP Message Protocol Data Unit (PDU)
Instance Attribute Summary collapse
- #tag ⇒ Array readonly
Instance Method Summary collapse
- #add_response? ⇒ Boolean private
- #advice ⇒ String private
- #app_tag ⇒ Integer private
-
#bind_parameters ⇒ OpenStruct
private
> :version, :name, :authentication.
- #bind_request? ⇒ Boolean private
-
#bind_result ⇒ Array
private
> [version, username, password].
-
#bind_result? ⇒ Boolean
private
A successful operation is indicated by a BindResponse with a resultCode set to success.
-
#error_message ⇒ String, FalseClass
private
Grep for error message.
-
#extended_response ⇒ String, NilClass
private
Message.
- #extended_response? ⇒ Boolean private
- #failure? ⇒ Boolean private
- #flag ⇒ String private
- #info ⇒ String private
- #matched_dn ⇒ String private
-
#message ⇒ String
private
First item from responses.yaml.
- #pdu_type ⇒ Symbol private
- #result_code ⇒ Integer private
- #result_code_symbol ⇒ Symbol private
-
#result_controls ⇒ Array<OpenStruct>
private
RFC-2251, an LDAP ‘control’ is a sequence of tuples, each consisting of - an OID - a boolean criticality flag defaulting FALSE - and an optional Octet String.
- #result_server_sasl_creds ⇒ Object private
-
#search_entry ⇒ Array, NilClass
private
[“dn”, [ entry… ]].
-
#search_parameters ⇒ OpenStruct, NilClass
private
> :version, :name, :authentication.
- #search_referral? ⇒ Boolean private
- #search_referrals ⇒ Object private
- #search_request? ⇒ Boolean private
- #search_result? ⇒ Boolean private
- #success? ⇒ Boolean private
Instance Attribute Details
#tag ⇒ Array (readonly)
34 |
# File 'lib/rom/ldap/pdu.rb', line 34 param :tag, reader: :private, type: Types::Strict::Array |
Instance Method Details
#add_response? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
193 194 195 |
# File 'lib/rom/ldap/pdu.rb', line 193 def add_response? pdu_type == :add_response end |
#advice ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
62 63 64 |
# File 'lib/rom/ldap/pdu.rb', line 62 def advice tag[2] end |
#app_tag ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 |
# File 'lib/rom/ldap/pdu.rb', line 40 def app_tag tag.ber_identifier & 0x1f end |
#bind_parameters ⇒ OpenStruct
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns => :version, :name, :authentication.
91 92 93 94 95 96 97 |
# File 'lib/rom/ldap/pdu.rb', line 91 def bind_parameters return unless bind_request? s = ::OpenStruct.new s.version, s.name, s.authentication = tag s end |
#bind_request? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
201 202 203 |
# File 'lib/rom/ldap/pdu.rb', line 201 def bind_request? pdu_type == :bind_request end |
#bind_result ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns => [version, username, password].
81 82 83 84 85 86 |
# File 'lib/rom/ldap/pdu.rb', line 81 def bind_result return unless bind_result? raise ResponseTypeInvalidError, 'Invalid bind_result' unless gteq_3? tag end |
#bind_result? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
A successful operation is indicated by a BindResponse with a resultCode set to success.
211 212 213 |
# File 'lib/rom/ldap/pdu.rb', line 211 def bind_result? pdu_type.eql?(:bind_result) end |
#error_message ⇒ String, FalseClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Grep for error message
173 174 175 |
# File 'lib/rom/ldap/pdu.rb', line 173 def tag[3][/comment: (.*), data/, 1] if tag[3] end |
#extended_response ⇒ String, NilClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Message
123 124 125 126 127 |
# File 'lib/rom/ldap/pdu.rb', line 123 def extended_response raise ResponseTypeInvalidError, 'Invalid extended_response' unless gteq_3? tag[3] if extended_response? end |
#extended_response? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
235 236 237 |
# File 'lib/rom/ldap/pdu.rb', line 235 def extended_response? pdu_type == :extended_response end |
#failure? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
247 248 249 |
# File 'lib/rom/ldap/pdu.rb', line 247 def failure? !success? end |
#flag ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
185 186 187 |
# File 'lib/rom/ldap/pdu.rb', line 185 def flag detailed_response[2] end |
#info ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
179 180 181 |
# File 'lib/rom/ldap/pdu.rb', line 179 def info detailed_response[1] end |
#matched_dn ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 |
# File 'lib/rom/ldap/pdu.rb', line 53 def matched_dn tag[1] end |
#message ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
First item from responses.yaml
165 166 167 |
# File 'lib/rom/ldap/pdu.rb', line 165 def detailed_response[0] end |
#pdu_type ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
255 256 257 |
# File 'lib/rom/ldap/pdu.rb', line 255 def pdu_type BER.fetch(:response, app_tag) || raise(ResponseTypeInvalidError, "Unknown pdu_type: #{app_tag}") end |
#result_code ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/rom/ldap/pdu.rb', line 46 def result_code tag[0] end |
#result_code_symbol ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
261 262 263 |
# File 'lib/rom/ldap/pdu.rb', line 261 def result_code_symbol BER.fetch(:result, result_code) end |
#result_controls ⇒ Array<OpenStruct>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
RFC-2251, an LDAP ‘control’ is a sequence of tuples, each consisting of
- an OID
- a boolean criticality flag defaulting FALSE
- and an optional Octet String
If only two fields are given, the second one may be either criticality or data, since criticality has a default value. RFC-2696 is a good example.
151 152 153 154 155 156 157 |
# File 'lib/rom/ldap/pdu.rb', line 151 def result_controls ctrls.map do |control| oid, level, value = control value, level = level, false if level&.is_a?(String) ::OpenStruct.new(oid: oid, criticality: level, value: value) end end |
#result_server_sasl_creds ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
72 73 74 75 76 |
# File 'lib/rom/ldap/pdu.rb', line 72 def result_server_sasl_creds return unless bind_result? && gteq4? tag[3] end |
#search_entry ⇒ Array, NilClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
- “dn”, [ entry… ]
133 134 135 136 137 |
# File 'lib/rom/ldap/pdu.rb', line 133 def search_entry raise ResponseTypeInvalidError, 'Invalid search_entry' unless gteq_2? tag if search_result? end |
#search_parameters ⇒ OpenStruct, NilClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns => :version, :name, :authentication.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/rom/ldap/pdu.rb', line 102 def search_parameters return unless search_request? s = ::OpenStruct.new s.base_object, s.scope, s.deref_aliases, s.size_limit, s.time_limit, s.types_only, s.filter, s.attributes = tag s end |
#search_referral? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
229 230 231 |
# File 'lib/rom/ldap/pdu.rb', line 229 def search_referral? pdu_type == :search_result_referral end |
#search_referrals ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
66 67 68 69 70 |
# File 'lib/rom/ldap/pdu.rb', line 66 def search_referrals return unless search_referral? tag[3] || EMPTY_ARRAY end |
#search_request? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
217 218 219 |
# File 'lib/rom/ldap/pdu.rb', line 217 def search_request? pdu_type.eql?(:search_request) end |
#search_result? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
223 224 225 |
# File 'lib/rom/ldap/pdu.rb', line 223 def search_result? pdu_type.eql?(:search_returned_data) end |
#success? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
241 242 243 |
# File 'lib/rom/ldap/pdu.rb', line 241 def success? SUCCESS_CODES.include?(result_code_symbol) end |