SecurityTokenHandler.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections.ObjectModel;
  3. using System.IdentityModel.Configuration;
  4. using System.IdentityModel.Selectors;
  5. using System.Security.Claims;
  6. using System.Xml;
  7. namespace System.IdentityModel.Tokens
  8. {
  9. public abstract class SecurityTokenHandler : ICustomIdentityConfiguration
  10. {
  11. public virtual bool CanValidateToken { get { return false; } }
  12. public virtual bool CanWriteToken { get { return false; } }
  13. public SecurityTokenHandlerConfiguration Configuration { get; set; }
  14. public SecurityTokenHandlerCollection ContainingCollection { get; internal set; }
  15. public abstract Type TokenType { get; }
  16. public virtual bool CanReadKeyIdentifierClause (XmlReader reader) {
  17. return false;
  18. }
  19. public virtual bool CanReadToken (string tokenString) {
  20. return false;
  21. }
  22. public virtual bool CanReadToken (XmlReader reader) {
  23. return false;
  24. }
  25. public virtual bool CanWriteKeyIdentifierClause (SecurityKeyIdentifierClause securityKeyIdentifierClause) {
  26. return false;
  27. }
  28. public virtual SecurityKeyIdentifierClause CreateSecurityTokenReference (SecurityToken token, bool attached) {
  29. throw new NotImplementedException ();
  30. }
  31. public virtual SecurityToken CreateToken (SecurityTokenDescriptor tokenDescriptor) {
  32. throw new NotImplementedException ();
  33. }
  34. protected virtual void DetectReplayedToken (SecurityToken token) {
  35. throw new NotImplementedException ();
  36. }
  37. public abstract string[] GetTokenTypeIdentifiers ();
  38. public virtual void LoadCustomConfiguration (XmlNodeList nodelist) {
  39. throw new NotImplementedException ();
  40. }
  41. public virtual SecurityKeyIdentifierClause ReadKeyIdentifierClause (XmlReader reader) {
  42. throw new NotImplementedException ();
  43. }
  44. public virtual SecurityToken ReadToken (string tokenString) {
  45. throw new NotImplementedException ();
  46. }
  47. public virtual SecurityToken ReadToken (XmlReader reader) {
  48. throw new NotImplementedException ();
  49. }
  50. public virtual SecurityToken ReadToken (XmlReader reader, SecurityTokenResolver tokenResolver) {
  51. return this.ReadToken (reader);
  52. }
  53. protected void TraceTokenValidationFailure (SecurityToken token, string errorMessage) {
  54. throw new NotImplementedException ();
  55. }
  56. protected void TraceTokenValidationSuccess (SecurityToken token) {
  57. throw new NotImplementedException ();
  58. }
  59. public virtual ReadOnlyCollection<ClaimsIdentity> ValidateToken (SecurityToken token) {
  60. throw new NotImplementedException ();
  61. }
  62. public virtual void WriteKeyIdentifierClause (XmlWriter writer, SecurityKeyIdentifierClause securityKeyIdentifierClause) {
  63. throw new NotImplementedException ();
  64. }
  65. public virtual string WriteToken (SecurityToken token) {
  66. throw new NotImplementedException ();
  67. }
  68. public virtual void WriteToken (XmlWriter writer, SecurityToken token) {
  69. throw new NotImplementedException ();
  70. }
  71. }
  72. }