Skip to content

天楚锐齿

人工智能 云计算 大数据 物联网 IT 通信 嵌入式

天楚锐齿

  • 下载
  • 物联网
  • 云计算
  • 大数据
  • 人工智能
  • Linux&Android
  • 网络
  • 通信
  • 嵌入式
  • 杂七杂八

Wildfly把部分url强制为只能https访问方式,其他url可以http访问

2018-07-10
    一个网站,把登录、注册部分的代码强制为https访问,其他内容类的使用http或https访问皆可,我们可以这样配置,使用WEB-INF/web.xml文件的security-constraint条目来实现。
原理,wildfly的security-constraint条目:
    这个security-constraint包含一个或多个web-resource-collection条目,web-resource-collection条目包含一系列可选的url-pattern(比如<url-pattern>/car_public/register</url-pattern>,又比如<url-pattern>/car_public/*</url-pattern>),后面再加一系列可选的http-method(比如<http-method>POST</http-method>)。
    auth-constraint这里不多讲,就是使用鉴权角色来控制对这些url的访问。
    user-data-constraint条目指定客户端到服务端的传输层安全需求,transport-guarantee包含三种类型的值:NONE、INTEGRAL、CONFIDENTIAL,其中NONE表示不需要传输层安全保护,INTEGRAL表示需要保证客户端和服务器端的传输数据完整性,CONFIDENTIAL表示需要保证客户端和服务器端的数据不被其他人窥探读写,一般来讲INTEGRAL和CONFIDENTIAL就是使用SSL(就是HTTPS)来传输,和WILDFLY_HOME/standalone/configuration/standalone.xml相对应:
<https-listener name=”https” socket-binding=”https” max-post-size=”974247881″ max-header-size=”974247881″ security-realm=”ApplicationRealm” enable-http2=”true”/>
…
<socket-binding name=”https” port=”${jboss.https.port:8443}”/>
…
<security-realm name=”ApplicationRealm”>
                <server-identities>
                    <ssl>
                        <keystore path=”cloud.car-ocean.com.keystore” relative-to=”jboss.server.config.dir” keystore-password=”car-ocean” alias=”server” key-password=”car-ocean” generate-self-signed-certificate-host=”cloud.car-ocean.com”/>
                    </ssl>
                </server-identities>
                <authentication>
                    <local default-user=”$local” allowed-users=”*” skip-group-loading=”true”/>
                    <properties path=”application-users.properties” relative-to=”jboss.server.config.dir”/>
                </authentication>
                <authorization>
                    <properties path=”application-roles.properties” relative-to=”jboss.server.config.dir”/>
                </authorization>
</security-realm>
举例(web.xml例子,这样/car_public/register必须使用https方式来访问,使用http来访问则会返回404):
…
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>WEB_APPLICATION_NAME</web-resource-name>
            <url-pattern>/car_public/register</url-pattern>
            <url-pattern>/car_public/sms_verify</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>
</web-app>
当然,如果所有http都要重定向到https,则更简单:
<socket-binding name=”http” port=”${jboss.https.port:80}”/>
<socket-binding name=”https” port=”${jboss.https.port:8443}”/>
<socket-binding name=”https-ext” port=”${jboss.https.port:443}”/>
把 http://xxx/ 重定向到 https://xxx/ :
<http-listener name=”default” socket-binding=”http” redirect-socket=”https-ext” />
把 http://xxx/ 重定向到 https://xxx:8443/ :
<http-listener name=”default” socket-binding=”http” redirect-socket=”https” />

Post navigation

Previous Post:

天楚闹钟app,响铃时实现拉起第三方音乐、听书、英语app进行播放

Next Post:

4G/5G时代汽车车机新玩法

发表回复 取消回复

要发表评论,您必须先登录。

个人介绍

需要么,有事情这里找联系方式:关于天楚锐齿

=== 美女同欣赏,好酒共品尝 ===

微信扫描二维码赞赏该文章:

扫描二维码分享该文章:

分类

  • Linux&Android (84)
  • Uncategorized (1)
  • 下载 (28)
  • 云计算 (39)
  • 人工智能 (10)
  • 大数据 (36)
  • 嵌入式 (34)
  • 杂七杂八 (35)
  • 物联网 (65)
  • 网络 (28)
  • 通信 (22)

归档

近期文章

  • 安装JumpServer作为堡垒机
  • xshell通过SOCKS隧道和代理实现ssh登录其他内网服务器
  • 使用stub_status和vts模块进行nginx性能监控
  • 国内使用Google的Gemini AI下AntiGravity的方式
  • 抖店云的虚机用Nginx代理解码抖店订单

近期评论

  • linux爱好者 发表在《Linux策略路由及iptables mangle、ip rule、ip route关系及一种Network is unreachable错误》
  • maxshu 发表在《使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序》
  • Ambition 发表在《使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序》
  • Ambition 发表在《使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序》
  • maxshu 发表在《Android9下用ethernet 的Tether模式来做路由器功能》

阅读量

  • 使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序 - 26,027次阅读
  • 卸载深信服Ingress、SecurityDesktop客户端 - 20,243次阅读
  • 车机技术之车规级Linux-Automotive Grade Linux(AGL) - 11,779次阅读
  • 在Android9下用ndk编译vSomeIP和CommonAPI以及使用例子 - 10,154次阅读
  • linux下的unbound DNS服务器设置详解 - 10,032次阅读
  • linux的tee命令导致ssh客户端下的shell卡住不动 - 9,308次阅读
  • Linux策略路由及iptables mangle、ip rule、ip route关系及一种Network is unreachable错误 - 9,071次阅读
  • 车机技术之360°全景影像(环视)系统 - 9,032次阅读
  • Windows下安装QEMU并在qemu上安装ubuntu和debian - 8,596次阅读
  • 车机技术之Android Automotive - 8,507次阅读

其他操作

  • 注册
  • 登录
  • 条目 feed
  • 评论 feed
  • WordPress.org

联系方式

地址
深圳市科技园

时间
周一至周五:  9:00~12:00,14:00~18:00
周六和周日:10:00~12:00

标签

android AT命令 CAN centos Hadoop hdfs ip ipv6 java kickstart linux mapreduce mini6410 modem nova OAuth openstack python socket ssh uboot 使用 内核 协议 安装 嵌入式 性能 报表 授权 数据 数据库 月报 模型 汽车 深度学习 源代码 统计 编译 网络 脚本 虚拟机 调制解调器 车机 迁移 金融
© 2026 天楚锐齿 | Powered by WordPress | Theme by MadeForWriters