//-----------------------------------------------------------------------
//
// Copyright (c) Andrew Arnott. All rights reserved.
//
//-----------------------------------------------------------------------
namespace RelyingPartyLogic {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DotNetOpenAuth.OAuth.ChannelElements;
public partial class IssuedRequestToken : IServiceProviderRequestToken {
///
/// Gets or sets the callback associated specifically with this token, if any.
///
///
/// The callback URI; or null if no callback was specifically assigned to this token.
///
public Uri Callback {
get { return this.CallbackAsString != null ? new Uri(this.CallbackAsString) : null; }
set { this.CallbackAsString = value != null ? value.AbsoluteUri : null; }
}
///
/// Gets or sets the version of the Consumer that requested this token.
///
///
/// This property is used to determine whether a must be
/// generated when the user authorizes the Consumer or not.
///
Version IServiceProviderRequestToken.ConsumerVersion {
get { return this.ConsumerVersionAsString != null ? new Version(this.ConsumerVersionAsString) : null; }
set { this.ConsumerVersionAsString = value != null ? value.ToString() : null; }
}
///
/// Gets the consumer key that requested this token.
///
string IServiceProviderRequestToken.ConsumerKey {
get { return this.Consumer.ConsumerKey; }
}
///
/// Gets the (local) date that this request token was first created on.
///
DateTime IServiceProviderRequestToken.CreatedOn {
get { return this.CreatedOnUtc.ToLocalTime(); }
}
///
/// Authorizes this request token to allow exchange for an access token.
///
///
/// Call this method when the user has completed web-based authorization.
///
public void Authorize() {
this.User = Database.LoggedInUser;
Database.DataContext.SaveChanges();
}
}
}