Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Basic認証の視覚化 / visualize basic authentication

Avatar for ozw ozw
May 13, 2019

Basic認証の視覚化 / visualize basic authentication

Avatar for ozw

ozw

May 13, 2019
Tweet

Other Decks in Technology

Transcript

  1. 3BDLNJEEMFXBSF class Middleware1 def initialize(app) # app == Middleware2 @app

    = app end def call(env) # Middleware2ͷcall͕ݺ͹ΕΔ. res = @app.call(env) # ඞཁʹԠͯ͡ॲཧΛߦ͏. res end end
  2. ྫɿTFOUSZͰͷ࢖ΘΕํ # sentry-raven
 def call(env) # ... begin response =

    @app.call(env) rescue Error raise # Don't capture Raven errors rescue Exception => e Raven::Rack.capture_exception(e, env) raise end # ... response end
  3. CBTJD@BVUI@NBSLͰͷ࢖͍ํ def call(env) status, headers, response = @app.call(env) if basic_auth?

    # </head> to <link rel="stylesheet" ...></head> # <body> to <body><div class="github-fork-ribbon" ...> new_response = insert_basic_auth_marks(response) # update body size. headers['Content-Length'] = new_response.bytesize.to_s response = [new_response] end [status, headers, response] end
  4. ໰୊ w αʔόʔଆͰ#"4*$ೝূΛ੾ͬͯ΋ΫϥΠΞϯτ ϒϥ΢ β ͸"VUIPSJ[BUJPOϔομΛૹΓଓ͚Δ w ࣮ࡍʹ#"4*$ೝূΛ͔ͨ͠Ͳ͏͔͸SBDLNJEEMFXBSFʹ ౉Δ৘ใ͔Β͸Θ͔Βͳ͍ ೝূʹ੒ޭͨ͠৔߹ͱೝূ͠

    ͳ͔ͬͨ৔߹Ͱม਺͕ಉ͡  w ͳͷͰɺݱঢ়͸"VUIPSJ[BUJPO#BTJDϔομͷ༗ແͷΈͰ ൑ఆ͍ͯ͠Δ αʔόʔͰೝূ੾ͬͨ͋ͱ΋SJCCPO͕දࣔ ͞Εͯ͠·͏