IAuthorizationService.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using OpenSim.Framework;
  29. namespace OpenSim.Services.Interfaces
  30. {
  31. // Generic Authorization service used for authorizing principals in a particular region
  32. public interface IAuthorizationService
  33. {
  34. //////////////////////////////////////////////////////
  35. // Authorized
  36. //
  37. // This method returns a simple true false indicating
  38. // whether or not a user has access to the region
  39. //
  40. bool IsAuthorizedForRegion(string userID, string regionID, out string message);
  41. }
  42. public class AuthorizationRequest
  43. {
  44. private string m_userID;
  45. private string m_firstname;
  46. private string m_surname;
  47. private string m_email;
  48. private string m_regionName;
  49. private string m_regionID;
  50. public AuthorizationRequest()
  51. {
  52. }
  53. public AuthorizationRequest(string ID, string RegionID)
  54. {
  55. m_userID = ID;
  56. m_regionID = RegionID;
  57. }
  58. public AuthorizationRequest(string ID,string FirstName, string SurName, string Email, string RegionName, string RegionID)
  59. {
  60. m_userID = ID;
  61. m_firstname = FirstName;
  62. m_surname = SurName;
  63. m_email = Email;
  64. m_regionName = RegionName;
  65. m_regionID = RegionID;
  66. }
  67. public string ID
  68. {
  69. get { return m_userID; }
  70. set { m_userID = value; }
  71. }
  72. public string FirstName
  73. {
  74. get { return m_firstname; }
  75. set { m_firstname = value; }
  76. }
  77. public string SurName
  78. {
  79. get { return m_surname; }
  80. set { m_surname = value; }
  81. }
  82. public string Email
  83. {
  84. get { return m_email; }
  85. set { m_email = value; }
  86. }
  87. public string RegionName
  88. {
  89. get { return m_regionName; }
  90. set { m_regionName = value; }
  91. }
  92. public string RegionID
  93. {
  94. get { return m_regionID; }
  95. set { m_regionID = value; }
  96. }
  97. }
  98. public class AuthorizationResponse
  99. {
  100. private bool m_isAuthorized;
  101. private string m_message;
  102. public AuthorizationResponse()
  103. {
  104. }
  105. public AuthorizationResponse(bool isAuthorized, string message)
  106. {
  107. m_isAuthorized = isAuthorized;
  108. m_message = message;
  109. }
  110. public bool IsAuthorized
  111. {
  112. get { return m_isAuthorized; }
  113. set { m_isAuthorized = value; }
  114. }
  115. public string Message
  116. {
  117. get { return m_message; }
  118. set { m_message = value; }
  119. }
  120. }
  121. }