Skip to content

echochamber/oven

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

oven

simple cookie middleware for Iron

extern crate cookie;
extern crate oven;

use oven::prelude::*;

fn initialize_my_webapp_pls() {
  // do some things, make an iron::Chain...
  chain.link(oven::new(SUPER_SECRET_KEYS_THAT_LETS_BE_HONEST_YOULL_PROBABLY_ACCIDENTALLY_PUT_IN_GITHUB));
}

fn handle_some_requests(req: &mut Request) {
  let foocookie = req.get_cookie("foo"); // foo = Option<cookie::Cookie>
  // clients can't tamper with foo- it's signed when set and verified when loaded.
  // invalid signatures are equivalent to the cookie not existing.
  let mut resp = Response::new();
  resp.set_cookie(Cookie::new("foo", "new and interesting value of foo!"));
  

About

simple cookie middleware for Iron

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%