针对数据库的JAX-WS身份验证 [英] JAX-WS authentication against a database

查看:68
本文介绍了针对数据库的JAX-WS身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实现一个JAX-WS Web服务,它将由外部Java和PHP客户端使用.

客户端必须使用每个客户端存储在数据库中的用户名和密码进行身份验证.

最好使用哪种身份验证机制来确保杂项客户端可以使用它?

解决方案

基本WS-Security可以与插入JAAS的Java和PHP客户端(以及其他客户端)一起使用,以提供数据库后端.如何实现这种依赖于您的容器.使用@RolesAllowed注释对Web服务方法进行注释,以控制调用用户必须具有的角色.所有J2EE容器都将提供某种机制来指定应针对哪些JAAS领域用户进行身份验证.例如,在Glassfish中,您可以使用管理控制台来管理领域,用户和组.然后,在application.xml中,指定领域和角色映射到组.

此处是以下内容的一些详细信息:如何在Glassfish上实现这一目标

在JBoss中使用 JBoss WS ,就更容易了./p>

您正在使用哪种JAX-WS实现以及在哪个容器中使用

?

I'm implementing a JAX-WS webservice that will be consumed by external Java and PHP clients.

The clients have to authenticate with a username and password stored in a database per client.

What authentication mechanism is best to use to make sure that misc clients can use it?

解决方案

Basic WS-Security would work with both Java and PHP clients (amongst others) plugged in to JAAS to provide a database backend . How to implement that kind of depends on your container. Annotate your web service methods with the @RolesAllowed annotation to control which roles the calling user must have. All J2EE containers will provide some mechanism to specify against which JAAS realm users should be authenticated. In Glassfish for example, you can use the admin console to manage realms, users and groups. In your application.xml you then specify the realm and the group to role mappings.

Here are some details of how to achieve this on Glassfish

With JBoss WS in JBoss, it's even easier.

What JAX-WS implementation are you using and in which container?

这篇关于针对数据库的JAX-WS身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆