SessionSecurityTokenHandler.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.IdentityModel.Selectors;
  5. using System.Security.Claims;
  6. using System.Xml;
  7. namespace System.IdentityModel.Tokens
  8. {
  9. public class SessionSecurityTokenHandler : SecurityTokenHandler
  10. {
  11. public static readonly ReadOnlyCollection<CookieTransform> DefaultCookieTransforms;
  12. public static readonly TimeSpan DefaultLifetime = TimeSpan.FromHours (10);
  13. private bool canValidateToken;
  14. private bool canWriteToken;
  15. private string cookieElementName;
  16. private string cookieNamespace;
  17. private Type tokenType;
  18. public override bool CanValidateToken { get { return canValidateToken; } }
  19. public override bool CanWriteToken { get { return canWriteToken; } }
  20. public virtual string CookieElementName { get { return cookieElementName; } }
  21. public virtual string CookieNamespace { get { return cookieNamespace; } }
  22. public static TimeSpan DefaultTokenLifetime { get { return SessionSecurityTokenHandler.DefaultLifetime; } }
  23. public virtual TimeSpan TokenLifetime { get; set; }
  24. public override Type TokenType { get { return tokenType; } }
  25. public ReadOnlyCollection<CookieTransform> Transforms { get; private set; }
  26. public SessionSecurityTokenHandler ()
  27. : this (SessionSecurityTokenHandler.DefaultCookieTransforms)
  28. { }
  29. public SessionSecurityTokenHandler (ReadOnlyCollection<CookieTransform> transforms)
  30. : this (transforms, SessionSecurityTokenHandler.DefaultLifetime)
  31. { }
  32. public SessionSecurityTokenHandler (ReadOnlyCollection<CookieTransform> transforms, TimeSpan tokenLifetime) {
  33. Transforms = transforms;
  34. TokenLifetime = tokenLifetime;
  35. }
  36. [MonoTODO]
  37. protected virtual byte[] ApplyTransforms (byte[] cookie, bool outbound) {
  38. throw new NotImplementedException ();
  39. }
  40. [MonoTODO]
  41. public override bool CanReadToken (XmlReader reader) {
  42. throw new NotImplementedException ();
  43. }
  44. [MonoTODO]
  45. public virtual SessionSecurityToken CreateSessionSecurityToken (ClaimsPrincipal principal, string context, string endpointId, DateTime validFrom, DateTime validTo) {
  46. throw new NotImplementedException ();
  47. }
  48. [MonoTODO]
  49. public override SecurityToken CreateToken (SecurityTokenDescriptor tokenDescriptor) {
  50. throw new NotImplementedException ();
  51. }
  52. [MonoTODO]
  53. public override string[] GetTokenTypeIdentifiers () {
  54. throw new NotImplementedException ();
  55. }
  56. [MonoTODO]
  57. public override void LoadCustomConfiguration (XmlNodeList customConfigElements) {
  58. throw new NotImplementedException ();
  59. }
  60. [MonoTODO]
  61. public override SecurityToken ReadToken (XmlReader reader) {
  62. throw new NotImplementedException ();
  63. }
  64. [MonoTODO]
  65. public virtual SecurityToken ReadToken (byte[] token, SecurityTokenResolver tokenResolver) {
  66. throw new NotImplementedException ();
  67. }
  68. [MonoTODO]
  69. public override SecurityToken ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver) {
  70. throw new NotImplementedException ();
  71. }
  72. [MonoTODO]
  73. protected void SetTransforms (IEnumerable<CookieTransform> transforms) {
  74. throw new NotImplementedException ();
  75. }
  76. [MonoTODO]
  77. protected virtual void ValidateSession (SessionSecurityToken securityToken) {
  78. throw new NotImplementedException ();
  79. }
  80. [MonoTODO]
  81. public override ReadOnlyCollection<ClaimsIdentity> ValidateToken (SecurityToken token) {
  82. throw new NotImplementedException ();
  83. }
  84. [MonoTODO]
  85. public virtual ReadOnlyCollection<ClaimsIdentity> ValidateToken (SessionSecurityToken token, string endpointId) {
  86. throw new NotImplementedException ();
  87. }
  88. [MonoTODO]
  89. public virtual byte[] WriteToken (SessionSecurityToken sessionToken) {
  90. throw new NotImplementedException ();
  91. }
  92. [MonoTODO]
  93. public override void WriteToken (XmlWriter writer, SecurityToken token) {
  94. throw new NotImplementedException ();
  95. }
  96. }
  97. }