11//! Authentication and authorization data structures
22
33use std:: collections:: BTreeSet ;
4- use chrono:: { DateTime , Utc } ;
54use iron;
65use hyper;
76
@@ -18,34 +17,8 @@ pub enum Scopes {
1817/// REST API authorization.
1918#[ derive( Clone , Debug , PartialEq ) ]
2019pub struct Authorization {
21- /// Subject of the request.
2220 pub subject : String ,
23-
24- /// Authorization scopes available to the subject.
2521 pub scopes : Scopes ,
26-
27- /// The authentication mechanism that provided this authorization data.
28- ///
29- /// In cases where authentication is delegated to other microservices via
30- /// assertion headers, this field stores the original authentication
31- /// mechanism that initially authenticated the subject.
32- pub auth_type : String ,
33-
34- /// Issuer of this request.
35- ///
36- /// When a system is operating on behalf of a subject, the subject field
37- /// contains the subject of the request, while the issuer field contains
38- /// the system that issued the request.
39- pub issuer : Option < String > ,
40-
41- /// Expiry deadline for this authorization data.
42- ///
43- /// This is used when the authorization data is cached, used to start a
44- /// session, or is used to construct a token passed back to the client.
45- ///
46- /// A `None` indicates that this authorization data must not be cached, and
47- /// is considered only valid for the current request.
48- pub expiry_deadline : Option < DateTime < Utc > > ,
4922}
5023impl iron:: typemap:: Key for Authorization {
5124 type Value = Authorization ;
@@ -83,9 +56,6 @@ impl iron::middleware::BeforeMiddleware for AllowAllMiddleware {
8356 req. extensions . insert :: < Authorization > ( Authorization {
8457 subject : self . 0 . clone ( ) ,
8558 scopes : Scopes :: All ,
86- auth_type : "bypass" . to_string ( ) ,
87- issuer : None ,
88- expiry_deadline : None ,
8959 } ) ;
9060 Ok ( ( ) )
9161 }
0 commit comments