标签: custom-authentication

Spring - 从控制器调用custom-authentication-provider

我在Spring Security配置中定义了自定义身份验证提供程序.这个类实现了AuthenticationProvider,我可以使用我页面上定义的表单成功登录.问题是我想要不仅在登录页面上调用此类,而且还要从注册页面调用此类.

注册页面使用不同的命令类,并收集比登录表单更多的信息.现在,当用户注册时,我调用适当的控制器,将记录添加到数据库,然后他们可以登录,但他们没有自动登录.由于他们刚刚在注册页面上给我他们的用户名/密码,我可以将其传递给自定义AuthenticationProvider类,以便他们也登录吗?

我已经尝试在注册控制器中创建一个org.springframework.security.Authentication类,并在我的客户AuthenticationProvider类上调用authenticate方法,这不会出错,但是用户没有登录.我是否必须在Spring Security过滤器链中调用更高的方法来完成此操作?我应该将控制器重定向到j_spring_security_check URL吗?如果是这样,我将如何传递用户名/密码?

java spring spring-security custom-authentication

6
推荐指数
1
解决办法
5140
查看次数

Azure Mobile Apps自定义身份验证

我正在使用新的Azure移动应用程序(不是旧的移动服务)作为我的Xamarin-App的后端.移动应用程序附带了一堆社交身份验证选项(例如Twitter,Facebook ......),但我希望使用自己的帐户表进行自己的身份验证.

对于旧的移动服务,自定义身份验证在此处描述:http: //azure.microsoft.com/de-de/documentation/articles/mobile-services-dotnet-backend-get-started-custom-authentication/ 此方法使用a LoginProvider,这在移动应用程序中不再可用.从移动服务迁移到移动应用程序的文档只是说:

移动应用程序和移动服务之间最大的区别之一是,在移动应用程序的情况下,登录由App Service Gateway处理,而不是代码站点. http://azure.microsoft.com/de-de/documentation/articles/app-service-mobile-dotnet-backend-migrating-from-mobile-services-preview/

那是什么意思?如何实现自定义身份验证?

谢谢 :)

.net authentication azure custom-authentication azure-web-sites

6
推荐指数
1
解决办法
1784
查看次数

django自定义用户模型组和权限

我正在尝试在django应用程序中实现自定义用户模型。

如果我仅复制并粘贴本文中的代码,则效果很好。但我希望这个自定义用户模型具有权限和组。因此,我将此继承添加到models.py中

class MyUser(AbstractBaseUser, PermissionsMixin):
Run Code Online (Sandbox Code Playgroud)

并将这些字段放入admin.py MyUserAdmin(UserAdmin)类:

('Permissions', {'fields': (
    'is_admin', 'is_staff', 'is_active', 'groups', 'user_permissions',
)}),
Run Code Online (Sandbox Code Playgroud)

但这对我来说很奇怪:

管理员截图

据我所知,它必须是两个容器:左边(我有)显示所有可用的组和权限,右边(我没有)显示所有当前用户的组和权限。

PS我尝试谷歌为它,发现只有一个帖子在reddit上是10个月大,但没有解决方案。

django permissions usergroups custom-authentication

6
推荐指数
1
解决办法
1365
查看次数

如何在asp.net mvc身份上设置自定义身份验证?

我需要的?! 我有一个ASP.NET身份系统设置并运行外部登录.无论出于何种原因,我需要在ASP.NET身份验证后设置自定义身份验证.我来解释一下怎么样?假设我有三个页面供用户查看我的应用程序,页面A,B,C. 谁可以查看Page A? 任何匿名用户都可以查看页面A. 谁可以查看页面A和B? 任何使用他/她的电子邮件和密码或外部登录创建帐户的用户. 谁可以查看Page A,B&C?

这是我想要设置自定义身份验证的地方.任何使用其电子邮件帐户或外部登录名创建帐户并且具有有效序列密钥的用户. 序列号? 我在ASP.NET身份中设置了一个类,如下所示:

 public class UserDetails : IdentityUser
    {
        public virtual MembershipSerial MembershipSerial { get; set; }
    }

    public class MembershipSerial
    {
        [HiddenInput(DisplayValue=false)]
        public int Id { get; set; }
        [HiddenInput(DisplayValue=false)]
        public string Serial { get; set; }
        [Required]
        [Display(Name="Membership Serial")]
        public string SerialConfirmed { get; set; }
    }

    public class MyDbContext : IdentityDbContext<UserDetails>
    {
        public MyDbContext()
            : base ("EFDbContext")
        {
        }
        public System.Data.Entity.DbSet<MembershipSerial> MembershipSerial { get; set; }
    }
Run Code Online (Sandbox Code Playgroud)

如上所述,我在课堂上设置了三个属性.字段ID用于序列号的ID,序列号是14个字母数字字母,由管理员输入,您可以看到它是一个不允许为空的隐藏字段.字段SerialConfirmed也是一个14字母数字字母,用户将输入这些字母进行身份验证,以便在应用程序中执行某些特定任务.整个概念是,应该推送登录用户进行第二种类型的身份验证,即身份验证与序列号. …

c# asp.net-mvc custom-authentication owin asp.net-identity

6
推荐指数
1
解决办法
724
查看次数

如何实现Firebase自定义身份验证后端?

我想要自定义 Firebase 身份验证,其中用户管理下级用户的角色。我需要指导来了解如何实现我自己的后端身份验证系统。文档中到处都提到“将用户名和密码发送到后端,该后端将生成自定义令牌”。这个后台是什么?我该去哪里追求这个?我的知识领域是 firebase、firebase 函数、Angular 2/4、ionic2 进行此讨论...谢谢

custom-authentication firebase firebase-authentication

6
推荐指数
1
解决办法
9398
查看次数

如何在views.py中调用django自定义编写的AuthenticationBackend的authenticate()方法?

我正在开发一个 Django 项目,在该项目中我定义了一个自定义用户模型,我需要为其编写自定义身份验证方法,按照我编写的文档,如下所示,但我在视图中调用它时遇到问题。 py请通过查看以下代码来帮助我
我已经定义了我的自定义后端,如下所示
我的自定义身份验证后端

from django.contrib.auth.backends import BaseBackend
from .models import User
from IntellerMatrix.CommonUtilities.constants import Constants


class AuthenticationBackend(BaseBackend):
    """
    Authentication Backend
    :To manage the authentication process of user
    """

    def authenticate(self, email=None, password=None):
        user = User.objects.get(email=email)
        if user is not None and user.check_password(password):
            if user.is_active == Constants.YES:
                return user
            else:
                return "User is not activated"
        else:
            return None

    def get_user(self, user_id):
        try:
            return User.objects.get(pk=user_id)
        except User.DoesNotExist:
            return None
Run Code Online (Sandbox Code Playgroud)

设置.py

AUTHENTICATION_BACKENDS = ['Modules.users.authentication.AuthenticationBackend',
                           'django.contrib.auth.backends.ModelBackend', ]
Run Code Online (Sandbox Code Playgroud)

视图.py

def …
Run Code Online (Sandbox Code Playgroud)

python django django-authentication custom-authentication

6
推荐指数
1
解决办法
5485
查看次数

IIS7中的自定义基本身份验证失败

我有一个ASP.NET MVC应用程序,有一些RESTful服务,我试图使用自定义基本身份验证来保护它们(它们是根据我自己的数据库进行身份验证).我已经通过编写HTTPModule实现了这一点.

我有一个方法附加到HttpApplication.AuthenticateRequest事件,它在身份验证失败的情况下调用此方法:

    private static void RejectWith401(HttpApplication app)
    {
        app.Response.StatusCode = 401;
        app.Response.StatusDescription = "Access Denied";
        app.CompleteRequest();
    }
Run Code Online (Sandbox Code Playgroud)

此方法附加到HttpApplication.EndRequest事件:

    public void OnEndRequest(object source, EventArgs eventArgs)
    {
        var app = (HttpApplication) source;
        if (app.Response.StatusCode == 401)
        {
            string val = String.Format("Basic Realm=\"{0}\"", "MyCustomBasicAuthentication");
            app.Response.AppendHeader("WWW-Authenticate", val);
        }
    }
Run Code Online (Sandbox Code Playgroud)

此代码添加"WWW-Authenticate"标头,告诉浏览器抛出登录对话框.当我使用Visual Studio的Web服务器进行本地调试时,这非常有效.但是当我在IIS7中运行它时失败了.

对于IIS7,除了匿名之外,我都关闭了内置的身份验证模块.它仍然返回HTTP 401响应,但它似乎正在删除WWW-Authenticate标头.

有任何想法吗?

authentication asp.net-mvc iis-7 httpmodule custom-authentication

5
推荐指数
1
解决办法
1423
查看次数

是否可以在 Stitch Custom Authentication/Stitch Auth 中使用 Firebase signInWithEmailAndPassword

我想使用 Firebase signInWithEmailAndPassword 在 mongodb Stitch 应用程序中对用户进行身份验证。是否可以?

我研究了使用 JWT 签名密钥的 Stitch 自定义身份验证。但我不知道是否可以从 Firebase signInWithEmailAndPassword 方法中获取 JWT 签名密钥

mongodb custom-authentication firebase-authentication

5
推荐指数
1
解决办法
476
查看次数

在 Firebase 中添加自定义 Oauth2 提供程序

我们正在创建一个应用程序并使用 firebase 身份验证。我们的组织中有一个现有的 oauth2 提供程序。是否可以在 firebase 中添加此自定义提供程序?所以我们将在我们的身份提供者中添加一个新客户端并配置 firebase 以便它可以接受来自它的令牌。

custom-authentication oauth-2.0 firebase

5
推荐指数
0
解决办法
88
查看次数

将自定义身份验证提供程序与Firebase链接

我通过Firebase了解到,通过将auth提供程序凭据链接到现有用户帐户,我可以允许用户使用多个身份验证提供程序登录我的应用程序.有可能链接自定义身份验证提供程序,如Linkedin?我读到我需要将AuthCredential对象传递给登录用户的linkWithCredential方法,但我找不到自定义的AuthCredential.

android linkedin custom-authentication firebase firebase-authentication

4
推荐指数
2
解决办法
1282
查看次数