Merge pull request #4536 from kumpera/block-rebind-of-banned-assemblies
[mono.git] / mcs / class / System.IdentityModel / System.IdentityModel.Tokens / SessionSecurityTokenHandler.cs
1 //
2 // SessionSecurityTokenHandler.cs
3 //
4 // Author:
5 //   Noesis Labs (Ryan.Melena@noesislabs.com)
6 //
7 // Copyright (C) 2014 Noesis Labs, LLC  https://noesislabs.com
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using System;
30 using System.Collections.Generic;
31 using System.Collections.ObjectModel;
32 using System.IdentityModel.Selectors;
33 using System.Security.Claims;
34 using System.Xml;
35
36 namespace System.IdentityModel.Tokens
37 {
38         public class SessionSecurityTokenHandler : SecurityTokenHandler
39         {
40                 public static readonly ReadOnlyCollection<CookieTransform> DefaultCookieTransforms;
41                 public static readonly TimeSpan DefaultLifetime = TimeSpan.FromHours (10);
42
43                 private bool canValidateToken;
44                 private bool canWriteToken;
45                 private string cookieElementName;
46                 private string cookieNamespace;
47                 private Type tokenType;
48
49                 public override bool CanValidateToken { get { return canValidateToken; } }
50                 public override bool CanWriteToken { get { return canWriteToken; } }
51                 public virtual string CookieElementName { get { return cookieElementName; } }
52                 public virtual string CookieNamespace { get { return cookieNamespace; } }
53                 public static TimeSpan DefaultTokenLifetime { get { return SessionSecurityTokenHandler.DefaultLifetime; } }
54                 public virtual TimeSpan TokenLifetime { get; set; }
55                 public override Type TokenType { get { return tokenType; } }
56                 public ReadOnlyCollection<CookieTransform> Transforms { get; private set; }
57
58                 public SessionSecurityTokenHandler ()
59                         : this (SessionSecurityTokenHandler.DefaultCookieTransforms)
60                 { }
61
62                 public SessionSecurityTokenHandler (ReadOnlyCollection<CookieTransform> transforms)
63                         : this (transforms, SessionSecurityTokenHandler.DefaultLifetime)
64                 { }
65
66                 public SessionSecurityTokenHandler (ReadOnlyCollection<CookieTransform> transforms, TimeSpan tokenLifetime) {
67                         Transforms = transforms;
68                         TokenLifetime = tokenLifetime;
69                 }
70
71                 [MonoTODO]
72                 protected virtual byte[] ApplyTransforms (byte[] cookie, bool outbound) {
73                         throw new NotImplementedException ();
74                 }
75
76                 [MonoTODO]
77                 public override bool CanReadToken (XmlReader reader) {
78                         throw new NotImplementedException ();
79                 }
80
81                 [MonoTODO]
82                 public virtual SessionSecurityToken CreateSessionSecurityToken (ClaimsPrincipal principal, string context, string endpointId, DateTime validFrom, DateTime validTo) {
83                         throw new NotImplementedException ();
84                 }
85
86                 [MonoTODO]
87                 public override SecurityToken CreateToken (SecurityTokenDescriptor tokenDescriptor) {
88                         throw new NotImplementedException ();
89                 }
90
91                 [MonoTODO]
92                 public override string[] GetTokenTypeIdentifiers () {
93                         throw new NotImplementedException ();
94                 }
95
96                 [MonoTODO]
97                 public override void LoadCustomConfiguration (XmlNodeList customConfigElements) {
98                         throw new NotImplementedException ();
99                 }
100
101                 [MonoTODO]
102                 public override SecurityToken ReadToken (XmlReader reader) {
103                         throw new NotImplementedException ();
104                 }
105
106                 [MonoTODO]
107                 public virtual SecurityToken ReadToken (byte[] token, SecurityTokenResolver tokenResolver) {
108                         throw new NotImplementedException ();
109                 }
110
111                 [MonoTODO]
112                 public override SecurityToken ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver) {
113                         throw new NotImplementedException ();
114                 }
115
116                 [MonoTODO]
117                 protected void SetTransforms (IEnumerable<CookieTransform> transforms) {
118                         throw new NotImplementedException ();
119                 }
120
121                 [MonoTODO]
122                 protected virtual void ValidateSession (SessionSecurityToken securityToken) {
123                         throw new NotImplementedException ();
124                 }
125
126                 [MonoTODO]
127                 public override ReadOnlyCollection<ClaimsIdentity> ValidateToken (SecurityToken token) {
128                         throw new NotImplementedException ();
129                 }
130
131                 [MonoTODO]
132                 public virtual ReadOnlyCollection<ClaimsIdentity> ValidateToken (SessionSecurityToken token, string endpointId) {
133                         throw new NotImplementedException ();
134                 }
135
136                 [MonoTODO]
137                 public virtual byte[] WriteToken (SessionSecurityToken sessionToken) {
138                         throw new NotImplementedException ();
139                 }
140
141                 [MonoTODO]
142                 public override void WriteToken (XmlWriter writer, SecurityToken token) {
143                         throw new NotImplementedException ();
144                 }
145         }
146 }