2 // SecurityTokenHandler.cs
5 // Noesis Labs (Ryan.Melena@noesislabs.com)
7 // Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.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.
30 using System.Collections.ObjectModel;
31 using System.IdentityModel.Configuration;
32 using System.IdentityModel.Selectors;
33 using System.Security.Claims;
36 namespace System.IdentityModel.Tokens
38 public abstract class SecurityTokenHandler : ICustomIdentityConfiguration
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; }
46 public virtual bool CanReadKeyIdentifierClause (XmlReader reader) {
50 public virtual bool CanReadToken (string tokenString) {
54 public virtual bool CanReadToken (XmlReader reader) {
58 public virtual bool CanWriteKeyIdentifierClause (SecurityKeyIdentifierClause securityKeyIdentifierClause) {
62 public virtual SecurityKeyIdentifierClause CreateSecurityTokenReference (SecurityToken token, bool attached) {
63 throw new NotImplementedException ();
66 public virtual SecurityToken CreateToken (SecurityTokenDescriptor tokenDescriptor) {
67 throw new NotImplementedException ();
70 protected virtual void DetectReplayedToken (SecurityToken token) {
71 throw new NotImplementedException ();
74 public abstract string[] GetTokenTypeIdentifiers ();
76 public virtual void LoadCustomConfiguration (XmlNodeList nodelist) {
77 throw new NotImplementedException ();
80 public virtual SecurityKeyIdentifierClause ReadKeyIdentifierClause (XmlReader reader) {
81 throw new NotImplementedException ();
85 public virtual SecurityToken ReadToken (string tokenString) {
86 throw new NotImplementedException ();
89 public virtual SecurityToken ReadToken (XmlReader reader) {
90 throw new NotImplementedException ();
93 public virtual SecurityToken ReadToken (XmlReader reader, SecurityTokenResolver tokenResolver) {
94 return this.ReadToken (reader);
97 protected void TraceTokenValidationFailure (SecurityToken token, string errorMessage) {
98 throw new NotImplementedException ();
101 protected void TraceTokenValidationSuccess (SecurityToken token) {
102 throw new NotImplementedException ();
105 public virtual ReadOnlyCollection<ClaimsIdentity> ValidateToken (SecurityToken token) {
106 throw new NotImplementedException ();
109 public virtual void WriteKeyIdentifierClause (XmlWriter writer, SecurityKeyIdentifierClause securityKeyIdentifierClause) {
110 throw new NotImplementedException ();
113 public virtual string WriteToken (SecurityToken token) {
114 throw new NotImplementedException ();
117 public virtual void WriteToken (XmlWriter writer, SecurityToken token) {
118 throw new NotImplementedException ();