//******************************************************************************************************
// ISecurityService.cs - Gbtc
//
// Copyright © 2012, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may
// not use this file except in compliance with the License. You may obtain a copy of the License at:
//
// http://www.opensource.org/licenses/MIT
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// Code Modification History:
// ----------------------------------------------------------------------------------------------------
// 05/18/2010 - Pinal C. Patel
// Generated original version of source code.
// 12/09/2010 - Pinal C. Patel
// Renamed Login operation to Authenticate and added GetUserData and RefreshUserData operations.
// 01/14/2011 - Pinal C. Patel
// Changed XML serializer from DataContractSerializer to XmlSerializer for more control over
// serialization of data.
// Added ResetPassword() and ChangePassword() methods.
// 07/22/2011 - Pinal C. Patel
// Switched REST endpoints to using query string for input parameters instead of passing them
// as part of the URL so sensitive information like password gets encrypted when used with SSL.
// 12/20/2012 - Starlynn Danyelle Gilliam
// Modified Header.
//
//******************************************************************************************************
using System.ServiceModel;
using System.ServiceModel.Web;
using GSF.Security;
using GSF.ServiceModel;
namespace GSF.Web.Embedded
{
///
/// Embedded WCF service contract used for securing external facing WCF services.
///
[ServiceContract, XmlSerializerFormat]
public interface ISecurityService : ISelfHostingService
{
///
/// Returns information about the current user.
///
/// An object of the user if user's security context has been initialized, otherwise null.
[OperationContract, WebGet(UriTemplate = "/getuserdata")]
UserData GetUserData();
///
/// Refreshes and returns information about the current user.
///
/// An object of the user if user's security context has been initialized, otherwise null.
[OperationContract, WebGet(UriTemplate = "/refreshuserdata")]
UserData RefreshUserData();
///
/// Authenticates a user and caches the security context upon successful authentication for subsequent use.
///
/// Username of the user.
/// Password of the user.
/// An object of the user.
[OperationContract, WebGet(UriTemplate = "/authenticate?username={username}&password={password}")]
UserData Authenticate(string username, string password);
///
/// Resets user password.
///
/// Answer to user's security question.
/// true if password is reset, otherwise false.
[OperationContract, WebGet(UriTemplate = "/resetpassword?securityanswer={securityAnswer}")]
bool ResetPassword(string securityAnswer);
///
/// Changes user password.
///
/// User's current password.
/// User's new password.
/// true if the password is changed, otherwise false.
[OperationContract, WebGet(UriTemplate = "/changepassword?oldpassword={oldPassword}&newpassword={newPassword}")]
bool ChangePassword(string oldPassword, string newPassword);
}
}