构建以下身份验证解决方案的最佳方法是什么?
我有一个独立的(没有与MVC集成)ServiceStack REST服务层.此服务是我所有数据的入口点.客户端上没有数据存储.
我有多个客户端(ASP.Net MVC 4站点,MonoTouch应用程序,MonoDroid应用程序,Silverlight应用程序,MonoMac应用程序等).
我想在服务级别提供身份验证(Facebook,Twitter等),包括将用户存储在MongoDBAuthRepository中,但允许客户端提供登录UI(我想要这个吗?).例如,对于MVC站点,我想将远程ServiceStack身份验证服务(包括Facebook,Twitter)与MVC的身份验证系统集成.似乎应该在服务端进行实际身份验证,但客户端需要保持身份验证响应.
我已经阅读了wiki,查看了SocialBootstrap,并阅读了论坛,但我仍然对这应该如何以分布式方式工作感到困惑.
我正在尝试让ASP.Net MVC 5 Google OAuth2身份验证正常运行.
当我在没有任何范围的情况下设置传入GoogleOauth2AuthenticationOptions时,我就能够成功登录.
var googlePlusOptions = new GoogleOAuth2AuthenticationOptions
{
ClientId = googleClientId,
ClientSecret = googleClientSecret,
SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie,
Provider = new GoogleOAuth2AuthenticationProvider()
{
OnAuthenticated = async ctx =>
{
ctx.Identity.AddClaim(new Claim("urn:tokens:googleplus:accesstoken", ctx.AccessToken));
}
},
};
app.UseGoogleAuthentication(googlePlusOptions);
Run Code Online (Sandbox Code Playgroud)
然后,此调用将返回一个设置了所有属性的ExternalLoginInfo对象
ExternalLoginInfo loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
Run Code Online (Sandbox Code Playgroud)
当我添加任何范围时,我没有得到任何返回的登录信息.它只是空的.
var googlePlusOptions = new GoogleOAuth2AuthenticationOptions
{
ClientId = googleClientId,
ClientSecret = googleClientSecret,
SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie,
Provider = new GoogleOAuth2AuthenticationProvider()
{
OnAuthenticated = async ctx =>
{
ctx.Identity.AddClaim(new Claim("urn:tokens:googleplus:accesstoken", ctx.AccessToken));
}
},
}; …Run Code Online (Sandbox Code Playgroud) asp.net-mvc oauth-2.0 google-oauth asp.net-mvc-5 asp.net-identity
有没有人知道我如何映射具有相同子类型的两个多对多集合的实体.
"正常"关系将是....
tbl_Parent
col_Parent_ID
tbl_Parent_Child_Xref
col_Parent_ID
col_Child_ID
tbl_Child
col_Child_ID
Run Code Online (Sandbox Code Playgroud)
替代关系是......
tbl_Parent
col_Parent_ID
tbl_Include_ParentChild_Xref
col_Parent_ID
col_Child_ID
tbl_Child
col_Child_ID
Run Code Online (Sandbox Code Playgroud)
实体和映射看起来像这样......
public partial class ParentEntity : AuditableDataEntity<ParentEntity>
{
public virtual IList<ChildEntity> Children { get; set; }
public virtual IList<ChildEntity> IncludedChildren { get; set; }
}
public partial class ParentMap : IAutoMappingOverride<ParentEntity>
{
public void Override(AutoMapping<ParentEntity> mapping)
{
mapping.Table("tbl_Parent");
mapping.HasManyToMany(x => x.Children)
.Table("tbl_Parent_Child_Xref")
.ParentKeyColumn("col_Parent_ID")
.ChildKeyColumn("col_Child_ID")
.Inverse()
.Cascade.All();
mapping.HasManyToMany(x => x.IncludedChildren)
.Table("tbl_Include_ParentChild_Xref")
.ParentKeyColumn("col_Parent_ID")
.ChildKeyColumn("col_Child_ID")
.Inverse()
.Cascade.All();
}
}
Run Code Online (Sandbox Code Playgroud)
我得到的错误是 "System.NotSupportedException:无法弄清楚多少属性'孩子'的另一面应该是什么."
我正在使用NHibernate 2.1.2,FluentNhibernate 1.0.
是否可以在web.config转换文件中包含变量?对于每个环境,我有基本相同的转换,只是具有不同的值.例如,对于开发环境,我有......
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="serverName" value="server1" xdt:Transform="Replace" xdt:Locator="Match(key)" />
<add key="serverPath" value="\\server1" xdt:Transform="Replace" xdt:Locator="Match(key)" />
</appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
对于QA环境,我有...
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="serverName" value="server2" xdt:Transform="Replace" xdt:Locator="Match(key)" />
<add key="serverPath" value="\\server2" xdt:Transform="Replace" xdt:Locator="Match(key)" />
</appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
唯一的区别是server1与server2的值.这是一个简单的例子,实际上,我在转换中多次使用服务器值.有没有办法在变换文件中声明一个多次使用的变量?就像是...
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<property name="server" value="server2" />
<appSettings>
<add key="serverName" value="${server}" xdt:Transform="Replace" xdt:Locator="Match(key)" />
<add key="serverPath" value="\\${server}" xdt:Transform="Replace" xdt:Locator="Match(key)" />
</appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud) web-deployment-project msdeploy web-config-transform webdeploy
我的个人帐户有一个YouTube频道,我的商家帐户有一个.我已将Google+信息页与两个频道相关联.在商家帐户中,我点击了"经理"(位于右上角的下拉列表中),并添加了我作为经理的个人Gmail帐户.这一切都很好.
不过,我现在尝试使用YouTube API列出我个人帐户有权管理的所有频道.我正在尝试使用此处的Google开发人员网页https://developers.google.com/youtube/v3/docs/channels/list#try-it但它只返回与我的个人帐户直接关联的一个频道.我希望它能够回归个人频道和商业频道.
有没有办法,api通话或设置可以让我为oauth用户拨打一个api电话,并查看用户有权管理的所有YouTube频道/ Google+信息页?
有没有办法设置MonoTouch.Dialog DialogViewController的位置?我已经将DialogViewController子类化,并在顶部添加了一个UIToolbar,现在我想将表视图向下移动相应的像素.
public class MyViewController : DialogViewController
{
UIToolbar toolbar;
public SessionsListViewController (RootElement rootElement) : base(rootElement)
{
this.toolbar = new UIToolbar(new RectangleF(0,0,768,44));
this.toolbar.Items = new UIBarButtonItem[0];
this.Add(toolbar);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Xamarin.Android和mvvmcross在Android上的listview中绑定Web图像.我收到这个错误了.
MvxBind:错误:7.13未找到视图类型 - Mvx.MvxHttpImageView Android.Views.InflateException:二进制XML文件行#1:错误膨胀类Mvx.MvxHttpImageView
这是我的斧头......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/com.mynamespace.android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Mvx.MvxHttpImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/iconeView"
local:MvxBind="{'HttpImageUrl':{'Path':'imageUrl'}}" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="30dp"
local:MvxBind="Text name" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="10dp"
local:MvxBind="Text tagline" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
asp.net-mvc ×1
google-api ×1
google-oauth ×1
google-plus ×1
msdeploy ×1
mvvmcross ×1
nhibernate ×1
oauth-2.0 ×1
servicestack ×1
webdeploy ×1
xamarin.ios ×1
youtube ×1
youtube-api ×1