Popularity
2.5
Declining
Activity
0.0
Stable
4
4
0
Programming language: Crystal
License: MIT License
Tags:
HTTP
digest-auth alternatives and similar shards
Based on the "HTTP" category.
Alternatively, view digest-auth alternatives based on common mentions on social networks and blogs.
-
route.cr
Minimum High Performance Middleware for Crystal Web Server. -
halite
💎HTTP Requests Client with a chainable REST API, built-in sessions and middlewares. -
cossack
Simple and flexible HTTP client for Crystal with middleware and test support. -
Cable
It's like ActionCable (100% compatible with JS Client), but you know, for Crystal -
http-protection
This library protects against typical web attacks. It was inspired in rack-protection Ruby gem. -
helmet
a port of the Node Helmet module to the Crystal programming language -
crystal-routing
Extensible library to deal with http request and string based routing in Crystal -
http-params-serializable
The HTTP params parsing module for Crystal 🤓 -
http_parser.cr
Crystal wrapper for Http Parser lib: https://github.com/joyent/http-parser -
multipart.cr
Adds multipart and multipart/form-data support to the crystal standard library -
ContentDisposition
Crystal shard to create HTTP Content-Disposition headers with proper escaping/encoding of filenames -
proxy-fetcher.cr
Crystal port of awesome Ruby ProxyFetcher gem -
http_distributor
http server which allows sneaky http request though it. -
router-simple.cr
simple path router inspired by Router::Simple. -
crystal-cossack
Simple and flexible HTTP client for Crystal with middleware and test support.
Collect and Analyze Billions of Data Points in Real Time
Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.
Promo
www.influxdata.com
Do you think we are missing an alternative of digest-auth or a related project?
README
Crystal Lang Digest Auth
Communicate with servers that implement digest auth.
Installation
- Add the dependency to your
shard.yml
:
dependencies:
digest-auth:
github: spider-gazelle/digest-auth
- Run
shards install
Usage
require "http/client"
require "digest-auth"
# New client per-connection, this keeps track of nonce count
digest_auth = DigestAuth.new
uri = URI.parse "http://foo.com/posts?id=30&limit=5"
# if you expect digest auth use a head request to get the challenge header
client = HTTP::Client.new uri
response = client.head uri.full_path
response.status_code # => 401
challenge = response.headers["WWW-Authenticate"]
uri.user = "username"
uri.password = "password"
# Generate the auth header, need to indicate if talking to IIS
auth_header = digest_auth.auth_header(uri, challenge, "get", iis: false)
# Make the request
response = client.get uri.full_path, HTTP::Headers{ "Authorization" => auth_header }
response.status_code # => 200
# Make a second request while the connection is still open
uri.path = "/posts/30"
auth_header = digest_auth.auth_header(uri, challenge, "post", iis: false)
response = client.post uri.full_path, HTTP::Headers{ "Authorization" => auth_header }, body: "hello!"
response.status_code # => 201
or using .before_request
require "http/client"
require "digest-auth"
digest_auth = DigestAuth.new
uri = URI.parse "http://foo.com/"
client = HTTP::Client.new uri
response = client.head uri.full_path
response.status_code # => 401
challenge = response.headers["WWW-Authenticate"]
uri.user = "username"
uri.password = "password"
client.before_request do |request|
req_path = URI.parse request.resource
uri.path = req_path.path
uri.query = req_path.query
auth_header = digest_auth.auth_header(uri, challenge, request.method, iis: false)
request.headers["Authorization"] = auth_header
end
client.get "/"
client.post "/some_path", body: "hello!"