新泽西请求进行认证

编程入门 行业动态 更新时间:2024-10-26 02:34:09
本文介绍了新泽西请求进行认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经在Glassfish工作的JavaEE 6 Web应用程序,这个应用程序已经具备了JSF的前端,并拥有认证机制((使用CDI和基于注解的安全性),所以有一个登录界面,用户输入用户名密码,preSS登录按钮和Java EE认证过程就开始了。

I have a working JavaEE 6 web application on Glassfish, this application already has a JSF frontend and has its authentication mechanism((Using CDI and annotation based security) So there is a login screen, user enters username password, press login button and Java EE authentication process begins.

现在我要还揭露我的一些服务类的REST服务的(我会用大概新泽西州),所以它也可以从移动设备到达。但让我担心的是登录的部分。

Now I want to "also" expose some of my service classes as a REST service (I will use Jersey probably), so it can also be reached from a mobile device. But what worries me is the login part.

我将使用完全相同的现有身份验证但现在我想我的应用程序将获得此证书由REST请求而不是从登录屏幕。然后继续使用已经存在现有的验证方法(从数据库校验用户名密码,,等)

I will use the exact same existing authentication But now I want my application will get this credentials from a Rest Request but not from the login screen. And then continue using the existing validation methods which already exists(check username password from DB,,etc)

我有点迷路了我怎么能做到这一点,我想我需要使用这些过滤器来拦截请求,并得到用户名密码,但不知道如何和哪一个?或者,我不需要这样的事?

I kinda got lost how can I do this, I think I need to use one of these filters to intercept the request and get the username password but not sure how and which one? Or I dont need anything like this?

推荐答案

您可以保护REST服务可以保护REST服务以同样的方式,例如:

You can protect the REST service the same way you protect the REST service, for example:

@Path("/foo") @RolesAllowed({"admin", "customer"}) public class Foo { @GET @Produces("text/plain") @RolesAllows("admin") public void adminOnly() {} public void adminOrCustomer() {} }

我猜你已经有角色和映射他们,所以只需使用你得到了相同的角色,应用服务器将处理剩下的事情。

I guess you already have roles and mappings for them so just use the same roles you got, the application server will take care of the rest.

更多推荐

新泽西请求进行认证

本文发布于:2023-10-10 01:22:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1477299.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:新泽西

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!