2 // SecurityTokenSerializer.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2005 Novell, Inc. http://www.novell.com
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:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
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.
29 using System.Collections.Generic;
30 using System.IdentityModel.Selectors;
31 using System.IdentityModel.Tokens;
34 namespace System.IdentityModel.Selectors
36 public abstract class SecurityTokenSerializer
38 protected SecurityTokenSerializer ()
43 public bool CanReadKeyIdentifier (XmlReader reader)
45 return CanReadKeyIdentifierCore (reader);
49 public bool CanReadKeyIdentifierClause (XmlReader reader)
51 return CanReadKeyIdentifierClauseCore (reader);
55 public bool CanReadToken (XmlReader reader)
57 return CanReadTokenCore (reader);
61 public SecurityKeyIdentifier ReadKeyIdentifier (
64 return ReadKeyIdentifierCore (reader);
68 public SecurityKeyIdentifierClause ReadKeyIdentifierClause (
71 return ReadKeyIdentifierClauseCore (reader);
75 public SecurityToken ReadToken (
77 SecurityTokenResolver tokenResolver)
79 return ReadTokenCore (reader, tokenResolver);
83 public bool CanWriteKeyIdentifier (
84 SecurityKeyIdentifier keyIdentifier)
86 return CanWriteKeyIdentifierCore (keyIdentifier);
90 public bool CanWriteKeyIdentifierClause (
91 SecurityKeyIdentifierClause keyIdentifierClause)
93 return CanWriteKeyIdentifierClauseCore (keyIdentifierClause);
97 public bool CanWriteToken (SecurityToken token)
99 return CanWriteTokenCore (token);
103 public void WriteKeyIdentifier (
105 SecurityKeyIdentifier keyIdentifier)
107 WriteKeyIdentifierCore (writer, keyIdentifier);
111 public void WriteKeyIdentifierClause (
113 SecurityKeyIdentifierClause keyIdentifierClause)
115 WriteKeyIdentifierClauseCore (writer, keyIdentifierClause);
119 public void WriteToken (
120 XmlWriter writer, SecurityToken token)
122 WriteTokenCore (writer, token);
125 protected abstract bool CanReadKeyIdentifierClauseCore (XmlReader reader);
127 protected abstract bool CanReadKeyIdentifierCore (XmlReader reader);
129 protected abstract bool CanReadTokenCore (XmlReader reader);
131 protected abstract SecurityKeyIdentifier ReadKeyIdentifierCore (
134 protected abstract SecurityKeyIdentifierClause ReadKeyIdentifierClauseCore (
137 protected abstract SecurityToken ReadTokenCore (
139 SecurityTokenResolver tokenResolver);
141 protected abstract bool CanWriteKeyIdentifierCore (
142 SecurityKeyIdentifier keyIdentifier);
144 protected abstract bool CanWriteKeyIdentifierClauseCore (
145 SecurityKeyIdentifierClause keyIdentifierClause);
147 protected abstract bool CanWriteTokenCore (SecurityToken token);
149 protected abstract void WriteKeyIdentifierCore (
151 SecurityKeyIdentifier keyIdentifier);
153 protected abstract void WriteKeyIdentifierClauseCore (
155 SecurityKeyIdentifierClause keyIdentifierClause);
157 protected abstract void WriteTokenCore (
158 XmlWriter writer, SecurityToken token);