赞
踩
最新文档:https://elsfs.gitee.io/
elsfs 框架:https://gitee.com/elsfs/elsfs-cloud
必要环境
常用工具
注意:必须配置 hosts ,禁止修改代码中配置成IP | 梯子、VPN 等软件会导致 hosts 配置失效,请关闭!!
127.0.0.1 nacos
127.0.0.1 mysql
127.0.0.1 redis
127.0.0.1 kibana
平台 | 地址 |
---|---|
gitee | git clone https://gitee.com/elsfs/elsfs-cloud.git |
github | git clone https://github.com/elsfs/elsfs-cloud.git 待开放 |
版本: mysql8.0+ 默认字符集: utf8mb4 默认排序规则: utf8mb4_general_ci
-- 核心数据库
source db/elsfs-mysql.sql;
-- nacos配置
source db/naocs-mysql.sql;
特别说明: host配置不要改成IP , why?
# elsfs/elsfs-optionl/elsfs-optionl-nacos/src/main/resources/application.yml
db:
num: 1
user: ${MYSQL-USER:root} #修改:用户名
password: ${MYSQL-PWD:root} #修改:密码, 特殊字符使用 '包裹'
url:
0: jdbc:mysql://${MYSQL_HOST:mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:nacos}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
找到对应模块的类,直接右键Main 启动即可
elsfs-optional/elsfs-optional-nacos/src/main/java/com/alibaba/nacos/NacosApplication.java
:::tip
访问: http://nacos:8848/nacos (默认账号密码 nacos/nacos)
:::
修改对应的命名空间elsfs-cloud下的配置文件redis,mysql配置
application-dev.yml
elsfs: security: # 配置公钥和私钥 key-pairs: - id: key created: 2023-11-19T10:00:00.000Z public-key: publicKey.pem private-key: privateKey.pem issuer: http://localhost:7001 spring: web: locale-resolver: accept_header locale: zh_CN data: redis: database: 0 host: redis port: 6379
elsfs-cloud-starter-dev.yml
spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver username: ${MYSQL_USER:root} password: ${MYSQL_PASSWORD:root} url: jdbc:mysql://${MYSQL_HOST:mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:elsfs-admin}?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai security: oauth2: client: registration: github: provider: github # App ID: 670371 client-id: xxx client-secret: xxx scope: user:email, read:user gitee: # 指定oauth登录提供者,该oauth登录由provider中的gitee来处理 provider: gitee # 客户端名字 client-name: Sign in with Gitee # 客户端id,使用自己的gitee的客户端id client-id: xxx # 客户端秘钥,使用自己的gitee的客户端秘钥 client-secret: xxx # 认证方式 authorization-grant-type: authorization_code # 回调地址 redirect-uri: http://127.0.0.1:7001/login/oauth2/code/gitee # 申请scope列表 scope: - user_info - emails qq: provider: qq # appid:应用的唯一标识。在OAuth2.0认证过程中,appid的值即为oauth_consumer_key的值。 # appid(oauth_consumer_key/client_id) client-id: your-app-app-id # appkey:appid对应的密钥,访问用户资源时用来验证应用的合法性。在OAuth2.0认证过程中,appkey的值即为oauth_consumer_secret的值。 # appkey(auth_consumer_secret/client_secret); client-secret: your-app-secret authorization-grant-type: authorization_code # 回调地址 redirect-uri: http://127.0.0.1:7001/login/oauth2/code/qq scope: - user_info - emails client-name: Sign in with QQ google: client-id: your-app-client-id client-secret: your-app-client-secret facebook: client-id: your-app-client-id client-secret: your-app-client-secret okta: client-id: your-app-client-id client-secret: your-app-client-secret login-client: provider: spring client-id: messaging-client client-secret: "$2a$10$hVq5XfeMHERLoFo6RBUFieyrZF8ElwvRRgrig/wb/IkXUzz3zCZhG" client-authentication-method: client_secret_basic authorization-grant-type: authorization_code redirect-uri: http://admin.elsfs.test:7001/login/oauth2/code/login-client scope: # - openid - message.read - message.write client-name: spring provider: github: user-name-attribute: login qq: user-name-attribute: openid # https://wiki.connect.qq.com/%e4%bd%bf%e7%94%a8authorization_code%e8%8e%b7%e5%8f%96access_token # 发起授权申请的地址 authorization-uri: https://graph.qq.com/oauth2.0/authorize # 获取token的地址 token-uri: https://graph.qq.com/oauth2.0/token?fmt=json&need_openid=1 # 获取用户信息的地址 使用Access Token来获取用户的OpenID user-info-uri: https://graph.qq.com/oauth2.0/me?fmt=json gitee: # 设置用户信息响应体中账号的字段 user-name-attribute: id # 获取token的地址 token-uri: https://gitee.com/oauth/token # 获取用户信息的地址 user-info-uri: https://gitee.com/api/v5/user # 发起授权申请的地址 authorization-uri: https://gitee.com/oauth/authorize spring: user-name-attribute: sub token-uri: http://localhost:7002/oauth2/token user-info-uri: http://localhost:7002/userinfo authorization-uri: http://localhost:7002/oauth2/authorize jwk-set-uri: http://localhost:7002/oauth2/jwks okta: authorization-uri: https://your-subdomain.oktapreview.com/oauth2/v1/authorize token-uri: https://your-subdomain.oktapreview.com/oauth2/v1/token user-info-uri: https://your-subdomain.oktapreview.com/oauth2/v1/userinfo jwk-set-uri: https://your-subdomain.oktapreview.com/oauth2/v1/keys
elsfs-optional/elsfs-optional-nacos/src/main/java/com/alibaba/nacos/NacosApplication.java
starter/elsfs-cloud-oauth2-starter/src/main/java/org/elsfs/cloud/Oauth2ApplicationStarter.java
starter/elsfs-cloud-starter/src/main/java/org/elsfs/cloud/AdminApplicationStarter.java
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。