Skip to content

Commit

Permalink
Merge pull request #16 from Metaswitch/revert-14-serde-auth
Browse files Browse the repository at this point in the history
Revert "Add metadata about auth to Authorization"
  • Loading branch information
mirw authored Sep 18, 2017
2 parents 07d460b + 0b644ac commit 18ce5cc
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 33 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "swagger"
version = "0.4.0"
version = "0.5.0"
authors = ["Metaswitch Networks Ltd"]
license = "Apache-2.0"
description = "A set of common utilities for Rust code generated by swagger-codegen"
Expand All @@ -23,4 +23,3 @@ serde_derive = { version = "1.0", optional = true }
hyper = "0.10"
base64 = "0.5"
iron = "0.5"
chrono = "0.4"
30 changes: 0 additions & 30 deletions src/auth.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Authentication and authorization data structures
use std::collections::BTreeSet;
use chrono::{DateTime, Utc};
use iron;
use hyper;

Expand All @@ -18,34 +17,8 @@ pub enum Scopes {
/// REST API authorization.
#[derive(Clone, Debug, PartialEq)]
pub struct Authorization {
/// Subject of the request.
pub subject: String,

/// Authorization scopes available to the subject.
pub scopes: Scopes,

/// The authentication mechanism that provided this authorization data.
///
/// In cases where authentication is delegated to other microservices via
/// assertion headers, this field stores the original authentication
/// mechanism that initially authenticated the subject.
pub auth_type: String,

/// Issuer of this request.
///
/// When a system is operating on behalf of a subject, the subject field
/// contains the subject of the request, while the issuer field contains
/// the system that issued the request.
pub issuer: Option<String>,

/// Expiry deadline for this authorization data.
///
/// This is used when the authorization data is cached, used to start a
/// session, or is used to construct a token passed back to the client.
///
/// A `None` indicates that this authorization data must not be cached, and
/// is considered only valid for the current request.
pub expiry_deadline: Option<DateTime<Utc>>,
}
impl iron::typemap::Key for Authorization {
type Value = Authorization;
Expand Down Expand Up @@ -83,9 +56,6 @@ impl iron::middleware::BeforeMiddleware for AllowAllMiddleware {
req.extensions.insert::<Authorization>(Authorization {
subject: self.0.clone(),
scopes: Scopes::All,
auth_type: "bypass".to_string(),
issuer: None,
expiry_deadline: None,
});
Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ extern crate serde_json;
#[macro_use]
extern crate serde_derive;
extern crate base64;
extern crate chrono;

#[macro_use]
extern crate hyper;
Expand Down

0 comments on commit 18ce5cc

Please sign in to comment.