StackOverflow的好人,请帮忙.我在我的ubuntu机器上设置了一个ejabberd服务器,添加了虚拟主机,设置了{access,register,[{allow,all}]}.并注册了一个管理员帐户.我不是linux大师,但我已经设法做了这个基本的设置.现在,从我的Win 7机器,使用Pidgin,我可以以管理员身份登录并可以访问许多管理功能.最重要的是我可以在服务器上创建新用户.问题是我不能用我的Android客户端使用asmack库来做到这一点.我可以建立连接和登录,但是当我尝试通过客户经理或通过发送IQ数据包注册新用户时,我得到禁止(403)响应错误.
AccountManager am = new AccountManager(connection);
Map<String, String> attributes = new HashMap<String, String>();
attributes.put("username", "my_user_name");
attributes.put("password", "my_password");
attributes.put("email", "foo@foo.com");
attributes.put("name", "my_full_name");
am.createAccount("my_user_name", "my_password", attributes);
Registration reg = new Registration();
reg.setType(IQ.Type.SET);
reg.setTo(connection.getServiceName());
// attributes.put("username", username);
// attributes.put("password", password);
// reg.setAttributes(attributes);
reg.addAttribute("username", username);
reg.addAttribute("password", password);
reg.addAttribute("email", email);
reg.addAttribute("name", fullName);
PacketFilter filter = new AndFilter(new PacketIDFilter(
reg.getPacketID()), new PacketTypeFilter(IQ.class));
PacketCollector collector = connection.createPacketCollector(filter);
connection.sendPacket(reg);
Run Code Online (Sandbox Code Playgroud)
有没有人有类似的问题或者可以告诉我我做错了什么?
谢谢
这是我的LogCat
10-10 10:00:26.249: DEBUG/StatusBarPolicy(1639): [BRIGHTHY] curNetwork=22003 curHPLMN=22003
10-10 10:00:26.839: INFO/System.out(21277): 10:00:26 AM SENT (1080244736): <iq id="fMJxx-4" …Run Code Online (Sandbox Code Playgroud) 请帮助,我正在构建一个带有离子前端的 .NET Core API。我想使用 ASPNET Core Identity 所以我或多或少地遵循了这个例子 https://identityserver4.readthedocs.io/en/release/quickstarts/6_aspnet_identity.html
这是我在 Startup.cs 中的内容
// Adds IdentityServer
services.AddIdentityServer()
.AddTemporarySigningCredential()
.AddInMemoryIdentityResources(Config.GetIdentityResources())
.AddInMemoryApiResources(Config.GetApiResources())
.AddInMemoryClients(Config.GetClients(Configuration))
.AddAspNetIdentity<ApplicationUser>();
Run Code Online (Sandbox Code Playgroud)
和
app.UseIdentity();
app.UseIdentityServer();
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = API_address,
RequireHttpsMetadata = false,
ApiName = "myAPIs"
});
Run Code Online (Sandbox Code Playgroud)
在我的 Config.cs 文件中,我有内存配置
public class Config
{
// scopes define the resources in your system
public static IEnumerable<IdentityResource> GetIdentityResources()
{
return new List<IdentityResource>
{
new IdentityResources.OpenId(),
new IdentityResources.Profile(),
};
}
// scopes define the API resources in your system
public static IEnumerable<ApiResource> GetApiResources() …Run Code Online (Sandbox Code Playgroud)