Class: PxModule::PerimeterX
- Inherits:
-
Object
- Object
- PxModule::PerimeterX
- Defined in:
- lib/perimeter_x.rb
Overview
PerimeterX Module
Instance Attribute Summary collapse
-
#first_party ⇒ Object
readonly
Returns the value of attribute first_party.
-
#px_activity_client ⇒ Object
Returns the value of attribute px_activity_client.
-
#px_config ⇒ Object
readonly
Returns the value of attribute px_config.
-
#px_http_client ⇒ Object
Returns the value of attribute px_http_client.
Class Method Summary collapse
-
.set_basic_config(basic_config) ⇒ Object
Static methods.
Instance Method Summary collapse
-
#initialize(request_config) ⇒ PerimeterX
constructor
A new instance of PerimeterX.
-
#verify(req) ⇒ Object
Instance Methods.
Constructor Details
#initialize(request_config) ⇒ PerimeterX
Returns a new instance of PerimeterX.
218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/perimeter_x.rb', line 218 def initialize(request_config) @px_config = Configuration.new(request_config).configuration @logger = @px_config[:logger] @px_http_client = PxHttpClient.new(@px_config) @px_activity_client = PerimeterxActivitiesClient.new(@px_config, @px_http_client) @first_party = FirstPartyManager.new(@px_config, @px_http_client, @logger) @px_cookie_validator = PerimeterxCookieValidator.new(@px_config) @px_s2s_validator = PerimeterxS2SValidator.new(@px_config, @px_http_client) @logger.debug('PerimeterX[initialize]') end |
Instance Attribute Details
#first_party ⇒ Object (readonly)
Returns the value of attribute first_party.
169 170 171 |
# File 'lib/perimeter_x.rb', line 169 def first_party @first_party end |
#px_activity_client ⇒ Object
Returns the value of attribute px_activity_client.
171 172 173 |
# File 'lib/perimeter_x.rb', line 171 def px_activity_client @px_activity_client end |
#px_config ⇒ Object (readonly)
Returns the value of attribute px_config.
168 169 170 |
# File 'lib/perimeter_x.rb', line 168 def px_config @px_config end |
#px_http_client ⇒ Object
Returns the value of attribute px_http_client.
170 171 172 |
# File 'lib/perimeter_x.rb', line 170 def px_http_client @px_http_client end |
Class Method Details
.set_basic_config(basic_config) ⇒ Object
Static methods
174 175 176 |
# File 'lib/perimeter_x.rb', line 174 def self.set_basic_config(basic_config) Configuration.set_basic_config(basic_config) end |
Instance Method Details
#verify(req) ⇒ Object
Instance Methods
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/perimeter_x.rb', line 179 def verify(req) begin # check module_enabled @logger.debug('PerimeterX[pxVerify]') if !@px_config[:module_enabled] @logger.warn('Module is disabled') return nil end # filter whitelist routes url_path = URI.parse(req.original_url).path if url_path && !url_path.empty? if check_whitelist_routes(px_config[:whitelist_routes], url_path) @logger.debug("PerimeterX[pxVerify]: whitelist route: #{url_path}") return nil end end # create context px_ctx = PerimeterXContext.new(@px_config, req) # Cookie phase , px_ctx = @px_cookie_validator.verify(px_ctx) if ! if !px_ctx.context[:mobile_error].nil? px_ctx.context[:s2s_call_reason] = "mobile_error_#{px_ctx.context[:mobile_error]}" end @px_s2s_validator.verify(px_ctx) end return handle_verification(px_ctx) rescue Exception => e @logger.error("#{e.backtrace.first}: #{e.} (#{e.class})") e.backtrace.drop(1).map {|s| @logger.error("\t#{s}")} return nil end end |