当前位置: 首页 > news >正文

企业推广建站浏览广告赚钱一天100元

企业推广建站,浏览广告赚钱一天100元,免费自己做网站手机,vs 2015 网站开发文章目录 1、使用Nginx增加认证。2、使用Spring Gateway增加认证 SkyWalking的可视化后台是没有用户认证功能的,默认下所有知道地址的用户都能访问,官网是建议通过网关增加认证。 本文介绍通过Nginx和Spring Gateway两种方式 1、使用Nginx增加认证。 生…

文章目录

    • 1、使用Nginx增加认证。
    • 2、使用Spring Gateway增加认证

SkyWalking的可视化后台是没有用户认证功能的,默认下所有知道地址的用户都能访问,官网是建议通过网关增加认证。
本文介绍通过Nginx和Spring Gateway两种方式

1、使用Nginx增加认证。

生成密钥

yum install -y httpd-tools
htpasswd -cb nginx/htpasswd skywalking rtgdbhyffddu#

配置nginx

worker_processes 1;
error_log stderr notice;
events {worker_connections 1024;
}
http {variables_hash_max_size 1024;access_log off;#ireal_ip_header X-Real-IP;charset utf-8;server {listen 8081;#auth_basic "Please enter the user name and password"; #这里是验证时的提示信息#auth_basic_user_file /data/skywalking/nginx/htpasswd;index  index.html;location / {root   html;index  index.html index.htm;#auth_basic on;auth_basic "Please enter the user name and password"; #这里是验证时的提示信息auth_basic_user_file /etc/nginx/htpasswd;proxy_pass http://172.17.0.9:8080;# WebSocket 穿透#proxy_set_header Origin "";#proxy_set_header Upgrade $http_upgrade;#proxy_set_header Connection "upgrade";}}
}

密码配置:/etc/nginx/htpasswd

skywalking:$apr1$FVaUB8RE$.brXLk5N.IsNRqm3.Vy2n1

在这里插入图片描述
在这里插入图片描述

2、使用Spring Gateway增加认证

主要是使用Spring Gateway和Spring Security的基础认证formLogin实现,
pom.xml使用的依赖包

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.penngo.web.gateway</groupId><artifactId>web_gateway</artifactId><version>1.0.0</version><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-loadbalancer</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-bootstrap</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>2022.0.4</version><type>pom</type><scope>import</scope></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</artifactId><version>3.1.0</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><mainClass>com.penngo.web.gateway.WebGatewayMain</mainClass><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin></plugins></build></project>

WebGatewayMain.java

package com.penngo.web.gateway;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class WebGatewayMain {public static void main(String[] args) {SpringApplication.run(WebGatewayMain.class, args);}
}

SecurityConfiguration.java配置

package com.penngo.web.gateway;import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.core.userdetails.MapReactiveUserDetailsService;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.server.SecurityWebFilterChain;import static org.springframework.security.config.Customizer.withDefaults;@EnableWebFluxSecurity
@Configuration
public class SecurityConfiguration {@BeanSecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) {http.authorizeExchange((authorize) -> authorize.anyExchange().authenticated()).cors(cors->cors.disable()).csrf(csrf->csrf.disable()).formLogin(withDefaults());return http.build();}/*** 可以在代码中配置密码,也可以在application.xml中配置密码* @return*/
//    @Bean
//    MapReactiveUserDetailsService userDetailsService() {
//
//        UserDetails user = User.withDefaultPasswordEncoder()
//                .username("admin")
//                .password("123456")
//                .roles("USER")
//                .build();
//        return new MapReactiveUserDetailsService(user);
//    }
}

application.yml

server:port: 8081servlet:encoding:force: truecharset: UTF-8enabled: true
spring:application:name: gatewayappsecurity:user:name: admin2password: 123456

bootstrap.yml

spring:cloud:gateway:routes:- id: skywalkinguri: http://localhost:8080/# 绑定ip白名单predicates:- RemoteAddr=127.0.0.1/32,192.168.245.65/32

运行效果
在这里插入图片描述
在这里插入图片描述

http://www.yayakq.cn/news/945197/

相关文章:

  • 网站模板 免费wordpress 团购 主题
  • 专业开发手机网站建设中国房地产新闻
  • 彩页设计网站域名到期对网站影响
  • 太原响应式网站建设手机版文章网站源码
  • 建设银行招标网站wordpress改wp admin
  • 本地做网站贵台州网站开发公司
  • 做网站需要多少钱 都包括什么重庆在线课程平台
  • 襄阳做网站找哪家公司广州地区做网站的
  • 怎么用php源代码做网站wordpress模板 物流
  • 北京网站建设模板主题企业网站策划怎么样
  • 建站是什么意思怎么做代理人金沙网站
  • 正规网站开发流程wordpress主题域名授权破解
  • 龙华企业网站建设WordPress哪些主题是免费的
  • 网站运行与维护中国化学工程第九建设公司网站
  • 广州哪家做网站wordpress 247
  • 地方网站 源码中国星子网
  • 广安做网站的公司北京西站附近景点
  • 瓷器网站源码网站搜索框怎么做
  • 做ar网站官方网站哪家做的最好
  • 北京app网站建设网站被黑了怎么恢复
  • app网站开发框架开发一款网站需要多少钱
  • 北京网站制作建设公司个人博客模板wordpress
  • 建设银行网站怎么查工资明细公司企业网站建设步骤
  • 网站流量共享海外sns网站
  • 做企业门户网站都关于网页设计的网站
  • 长泰网站建设怎样建官方网站
  • 网站建设活动策划网站建设的基本技术步骤
  • 大连网站建设哪家专业浙江个人网站备案
  • 网站 规划方案烟台专业做网站公司有哪些
  • 沈阳犀牛云做网站怎么样链接交换平台