@@ -17,10 +17,25 @@ pub enum Scopes {
1717/// REST API authorization.
1818#[ derive( Clone , Debug , PartialEq ) ]
1919pub struct Authorization {
20- /// Authenticated subject of the request
20+ /// Subject for which authorization is granted
21+ /// (i.e., what may be accessed.)
2122 pub subject : String ,
22- /// Authorization scopes of the authenticated subject
23+
24+ /// Scopes for which authorization is granted
25+ /// (i.e., what types of access are permitted).
2326 pub scopes : Scopes ,
27+
28+ /// Identity of the party to whom authorization was granted, if available
29+ /// (i.e., who is responsible for the access).
30+ ///
31+ /// In an OAuth environment, this is the identity of the client which
32+ /// issued an authorization request to the resource owner (end-user),
33+ /// and which has been directly authorized by the resource owner
34+ /// to access the protected resource. If the client delegates that
35+ /// authorization to another service (e.g., a proxy or other delegate),
36+ /// the `issuer` is still the original client which was authorized by
37+ /// the resource owner.
38+ pub issuer : Option < String > ,
2439}
2540impl iron:: typemap:: Key for Authorization {
2641 type Value = Authorization ;
@@ -58,6 +73,7 @@ impl iron::middleware::BeforeMiddleware for AllowAllMiddleware {
5873 req. extensions . insert :: < Authorization > ( Authorization {
5974 subject : self . 0 . clone ( ) ,
6075 scopes : Scopes :: All ,
76+ issuer : None ,
6177 } ) ;
6278 Ok ( ( ) )
6379 }
0 commit comments