Giter Site home page Giter Site logo

Comments (5)

ahmadnassri avatar ahmadnassri commented on June 13, 2024

agreed, I've been working on adding that.

from app-restconsole.

ecammit avatar ecammit commented on June 13, 2024

Seconded

from app-restconsole.

ahmadnassri avatar ahmadnassri commented on June 13, 2024

Guys, I've never used digest auth before, is there a quick and easy way to test a server side implementation of it?
can you point me to some service already out there that uses it so I can test against?

thanks.

from app-restconsole.

dkotvan avatar dkotvan commented on June 13, 2024

Sorry, I don't know a service to test.
But I wrote a simple example of a digest server in ruby using rack.

  • Install ruby and rack (if you don't is easy to find tutorials in web)
  • Create a file with the contents below and save as config.ru
  • Run rackup at command line
require "rubygems"
require "rack"

class AuthDigest
  REALM = "realm"
  OPAQUE = "opaque"
  USERNAME = "username"
  PASSWORD = "password"

  def initialize(app)
    @app = app
  end

  def call(env)
    secure_app = Rack::Auth::Digest::MD5.new(@app) do |username|
      Digest::MD5.hexdigest("#{username}:#{REALM}:#{PASSWORD}") if USERNAME == username
    end

    secure_app.realm = REALM
    secure_app.opaque = OPAQUE
    secure_app.passwords_hashed = true

    secure_app.call(env)
  end
end

App = Rack::Builder.new
  use AuthDigest

  map "/" do
    [200, {"Content-Type" => "text/plain"}, "Authenticated"]
  end
end

from app-restconsole.

ahmadnassri avatar ahmadnassri commented on June 13, 2024

thank you! this is exactly what I needed.

from app-restconsole.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.