如何使用标准属性android:文本在我的自定义视图?(How to use standard attribute android:text in my custom view?)
我写了一个扩展
RelativeLayout
的自定义视图 。 我的视图有文本,所以我想使用标准的android:text
而不需要指定一个<declare-styleable>
, 而不使用自定义命名空间xmlns:xxx
每次我使用我的自定义视图。这是我使用我的自定义视图的xml:
<my.app.StatusBar android:id="@+id/statusBar" android:text="this is the title"/>
如何获取属性值? 我想我可以得到android:text属性
TypedArray a = context.obtainStyledAttributes(attrs, ???);
但是什么是
???
在这种情况下(在attr.xml中没有样式)?I wrote a custom view that extends
RelativeLayout
. My view has text, so I want to use the standardandroid:text
without the need to specify a<declare-styleable>
and without using a custom namespacexmlns:xxx
every time I use my custom view.this is the xml where I use my custom view:
<my.app.StatusBar android:id="@+id/statusBar" android:text="this is the title"/>
How can I get the attribute value? I think I can get the android:text attribute with
TypedArray a = context.obtainStyledAttributes(attrs, ???);
but what is
???
in this case (without a styleable in attr.xml)?
原文:https://stackoverflow.com/questions/18013971
最满意答案
您从Facebook获得的任何声明都将传递给您的自定义用户服务的
AuthenticateExternal
方法。 在那时,他们是你声称做任何你想做的事。如果您没有从Facebook获得所需的声明,我建议您构建一个独立的MVC应用程序,以便首先解决该问题。
I just ended up using the facebook graph to get the user profile.
A user service may be another way to do it but this works for me.
using (var client = new HttpClient()) { var result = client.GetAsync("https://graph.facebook.com/me?fields=first_name,last_name&access_token=" + context.AccessToken).Result; if (result.IsSuccessStatusCode) { var userInformation = result.Content.ReadAsStringAsync().Result; var fbUser = JsonConvert.DeserializeObject<FacebookUser>(userInformation); context.Identity.AddClaim(new System.Security.Claims.Claim(IdentityServer3.Core.Constants.ClaimTypes.GivenName, fbUser.first_name)); context.Identity.AddClaim(new System.Security.Claims.Claim(IdentityServer3.Core.Constants.ClaimTypes.FamilyName, fbUser.last_name)); context.Identity.AddClaim(new System.Security.Claims.Claim("role", "Guest")); } }
相关问答
更多-
我不知道你是否终于找到了解决方案,但我试图做一些非常相似的事情,我仍然把这些难题放在一起。 我曾尝试将此作为评论发布,而不是回答,因为我没有提供真正的解决方案,但时间太长。 显然,所有的WebAPI Owin OAuth选项都是基于浏览器的,即它们需要很多浏览器重定向请求,这些请求不适合原生移动应用程序(我的情况)。 我仍在调查和尝试,但正如孙红叶在其博客文章的评论中简要描述的, http://blogs.msdn.com/b/webdev/archive/2013/09/20/understanding- ...
-
.NET Core Identity Server 4身份验证与身份验证(.NET Core Identity Server 4 Authentication VS Identity Authentication)[2023-11-07]
TL; DR IdentityServer =通过OAuth 2.0 / OpenId-Connect进行令牌加密和验证服务 ASP.NET身份= ASP.NET中的当前身份管理策略 - 我如何进行身份验证,类似于以前版本的.Net所做的方式,旧方式仍然有效,或者是否有更新的版本。 我看不出为什么你无法在ASP.NET Core中实现旧的方式,但总的来说,该策略已被ASP.NET身份所取代,并且ASP.NET Identity在ASP.NET Core中仍然活着。 https://docs.microsof ... -
您从Facebook获得的任何声明都将传递给您的自定义用户服务的AuthenticateExternal方法。 在那时,他们是你声称做任何你想做的事。 如果您没有从Facebook获得所需的声明,我建议您构建一个独立的MVC应用程序,以便首先解决该问题。 I just ended up using the facebook graph to get the user profile. A user service may be another way to do it but this works for ...
-
AFAIK,这个“名称”逻辑在最新版本的框架中没有改变。 如此处所述,默认情况下,用于填充Identity.Name属性的声明类型一直是: http : //schemas.xmlsoap.org/ws/2005/05/identity/claims/name 因此,如果您的SAML令牌包含此类声明,它将用作用户的“名称”(由您决定要放入此声明的哪个AD属性:userPrincipalName,displayName,mail,...) 。 该默认属性可以在代码中或web.config中重写。 这个页面提到 ...
-
去你的facebook应用程序开发网站。 打开你的页面。 转到Facebook登录选项下的设置选项并更改您的有效OAuth重定向网址。 你必须在该部分给你的网站有效的路径。 对于本地主机,你可以尝试这样 - HTTP://本地主机:8080 / fb_login_local / Go to you facebook app development website. Open your page. Go to Facebook Login option under it go to setting optio ...
-
如何从Identity Server部分登录进行身份验证(How to authenticate or not from an Identity Server partial login)[2022-05-13]
1)如果用户成功选择了一个组织,我可以使用GetPartialLoginResumeUrlAsync来恢复登录...但为了完成这项工作,我相信我必须使用UpdatePartialLoginClaimsAsync手动添加sub,name,idp,amr和auth time声明。 有更简单的方法吗? 这就是预期的工作方式:这些是登录过程中所需的声明。 2)如果用户不成功(可能他们花了很长时间选择一个组织,现在他们已被禁用),我该如何完成该过程但返回错误消息? 在用户服务中,我刚刚创建了一个带有错误消息的Auth ... -
在WebAPI应用程序中过滤Identity 2.0声明票证的位置?(Where to filter Identity 2.0 claim ticket in a WebAPI app?)[2022-10-01]
您必须实现DelegationHandler并将所有身份验证例程放入其中。 在应用程序启动时注册(启用DI使用): private static void RegisterHandlers(HttpConfiguration config) { var authHandler = new MyFacebookAuthHandler(); config.MessageHandlers.Add(authHandler); } 这是一个实施的例子: public class MyFacebook ... -
Facebook doc上有详细的登录信息 。 在这里引用它的一些重要部分: 因为您的游戏是在iframe中加载的,所以返回302以将用户重定向到登录对话框将不会成功。 相反,您必须将顶部(或_top)框架定位为重定向,这会导致父窗口重定向到“登录”对话框URL。 并且: 使用非JavaScript SDK重定向方法时,它们将被发送回传递给Login Dialog的redirect_uri。 在这种情况下,我们建议您将此redirect_uri设置为游戏的Canvas URL。 由于signed_reque ...
-
是的,当您发出部分登录时, AuthenticateResult ctor上会出现过载,您可以在其中传递声明。 这些将通过GetIdentityServerPartialLoginAsync在部分登录页面中提供。 So it turns out claims aren't present for a partial login. I was able to obtain them from a UserService when composing an AuthenticateResult for Part ...
-
您好,IS用户, 因此,在向WSO2 Identity Server进行身份验证后查看尾随空格的报告后,我检查了测试用户的已保存密码。 不幸的是,我在保存的登录中有一个尾随空格。 再加上错误,这会导致这种奇怪的行为(特别是如果您在测试服务器上输入登录凭据)。 所以这大约是我的用户错误的75%和大约25%的IS错误。 如果wso2 jira中已经存在bug问题,我将查看,否则我将提交错误报告。 更新:提交错误: https ://wso2.org/jira/browse/IDENTITY-5864 干杯垫 H ...