Prepare XM for Http additions
[mono.git] / mcs / class / System.IdentityModel / System.IdentityModel.Tokens / SecurityTokenHandler.cs
1 //
2 // SecurityTokenHandler.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.ObjectModel;
31 using System.IdentityModel.Configuration;
32 using System.IdentityModel.Selectors;
33 using System.Security.Claims;
34 using System.Xml;
35
36 namespace System.IdentityModel.Tokens
37 {
38         public abstract class SecurityTokenHandler : ICustomIdentityConfiguration
39         {
40                 public virtual bool CanValidateToken { get { return false; } }
41                 public virtual bool CanWriteToken { get { return false; } }
42                 public SecurityTokenHandlerConfiguration Configuration { get; set; }
43                 public SecurityTokenHandlerCollection ContainingCollection { get; internal set; }
44                 public abstract Type TokenType { get; }
45
46                 public virtual bool CanReadKeyIdentifierClause (XmlReader reader) {
47                         return false;
48                 }
49
50                 public virtual bool CanReadToken (string tokenString) {
51                         return false;
52                 }
53
54                 public virtual bool CanReadToken (XmlReader reader) {
55                         return false;
56                 }
57
58                 public virtual bool CanWriteKeyIdentifierClause (SecurityKeyIdentifierClause securityKeyIdentifierClause) {
59                         return false;
60                 }
61
62                 public virtual SecurityKeyIdentifierClause CreateSecurityTokenReference (SecurityToken token, bool attached) {
63                         throw new NotImplementedException ();
64                 }
65
66                 public virtual SecurityToken CreateToken (SecurityTokenDescriptor tokenDescriptor) {
67                         throw new NotImplementedException ();
68                 }
69
70                 protected virtual void DetectReplayedToken (SecurityToken token) {
71                         throw new NotImplementedException ();
72                 }
73
74                 public abstract string[] GetTokenTypeIdentifiers ();
75
76                 public virtual void LoadCustomConfiguration (XmlNodeList nodelist) {
77                         throw new NotImplementedException ();
78                 }
79
80                 public virtual SecurityKeyIdentifierClause ReadKeyIdentifierClause (XmlReader reader) {
81                         throw new NotImplementedException ();
82                 }
83
84
85                 public virtual SecurityToken ReadToken (string tokenString) {
86                         throw new NotImplementedException ();
87                 }
88
89                 public virtual SecurityToken ReadToken (XmlReader reader) {
90                         throw new NotImplementedException ();
91                 }
92
93                 public virtual SecurityToken ReadToken (XmlReader reader, SecurityTokenResolver tokenResolver) {
94                         return this.ReadToken (reader);
95                 }
96
97                 protected void TraceTokenValidationFailure (SecurityToken token, string errorMessage) {
98                         throw new NotImplementedException ();
99                 }
100
101                 protected void TraceTokenValidationSuccess (SecurityToken token) {
102                         throw new NotImplementedException ();
103                 }
104
105                 public virtual ReadOnlyCollection<ClaimsIdentity> ValidateToken (SecurityToken token) {
106                         throw new NotImplementedException ();
107                 }
108
109                 public virtual void WriteKeyIdentifierClause (XmlWriter writer, SecurityKeyIdentifierClause securityKeyIdentifierClause) {
110                         throw new NotImplementedException ();
111                 }
112
113                 public virtual string WriteToken (SecurityToken token) {
114                         throw new NotImplementedException ();
115                 }
116
117                 public virtual void WriteToken (XmlWriter writer, SecurityToken token) {
118                         throw new NotImplementedException ();
119                 }
120         }
121 }