docs: 增加右下角导航;

调整identity显示级别
This commit is contained in:
wintel
2025-04-26 15:04:49 +08:00
parent 107e297e01
commit 89fe623a72
3 changed files with 114 additions and 20 deletions

View File

@@ -1,4 +1,13 @@
/*
* @Author: yubaolee <yubaolee@163.com> | ahfu~ <954478625@qq.com>
* @Date: 2025-04-23 23:37:29
* @LastEditTime: 2025-04-26 15:00:36
* @Description:
* Copyright (c) 2025 by yubaolee | ahfu~ , All Rights Reserved.
*/
import { defineClientConfig } from 'vuepress/client'
import { h } from 'vue'
import { Layout } from 'vuepress-theme-plume/client'
// import RepoCard from 'vuepress-theme-plume/features/RepoCard.vue'
// import NpmBadge from 'vuepress-theme-plume/features/NpmBadge.vue'
// import NpmBadgeGroup from 'vuepress-theme-plume/features/NpmBadgeGroup.vue'
@@ -7,16 +16,16 @@ import { defineClientConfig } from 'vuepress/client'
// import CustomComponent from './theme/components/Custom.vue'
// import './theme/styles/custom.css'
import AsideNav from './theme/components/AsideNav.vue'
export default defineClientConfig({
enhance({ app }) {
// built-in components
// app.component('RepoCard', RepoCard)
// app.component('NpmBadge', NpmBadge)
// app.component('NpmBadgeGroup', NpmBadgeGroup)
// app.component('Swiper', Swiper) // you should install `swiper`
// your custom components
// app.component('CustomComponent', CustomComponent)
setup() {
// setupThemeColors()
},
layouts: {
Layout: h(Layout, null, {
'aside-outline-after': () => h(AsideNav),
}),
},
})

View File

@@ -0,0 +1,86 @@
<!--
* @Author: yubaolee <yubaolee@163.com> | ahfu~ <954478625@qq.com>
* @Date: 2025-04-26 14:59:00
* @LastEditTime: 2025-04-26 15:02:32
* @Description: 右下角导航
* Copyright (c) 2025 by yubaolee | ahfu~ , All Rights Reserved.
-->
<script setup lang="ts">
import { computed } from 'vue'
import { VPLink } from 'vuepress-theme-plume/client'
import { useRouteLocale } from 'vuepress/client'
interface Locale {
star: string
issue: string
sponsor: string
}
const locales: Record<string, Locale> = {
'/': { star: '在 gitee 上 Star', issue: '遇到问题?', sponsor: '喝杯奶茶' },
'/en/': { star: 'Star on GitHub', issue: 'Create Issues', sponsor: 'Buy me a Bubble Tea' },
}
const lang = useRouteLocale()
const locale = computed(() => locales[lang.value])
</script>
<template>
<div class="aside-nav-wrapper">
<VPLink class="link" no-icon href="https://gitee.com/dotnetchina/OpenAuth.Net">
<span class="vpi-github-star" />
<span class="link-text">{{ locale.star }}</span>
<span class="vpi-arrow-right" />
</VPLink>
<VPLink class="link" no-icon href="https://gitee.com/dotnetchina/OpenAuth.Net/issues/new">
<span class="vpi-github-issue" />
<span class="link-text">{{ locale.issue }}</span>
<span class="vpi-arrow-right" />
</VPLink>
<!-- <VPLink class="link" href="/sponsor/">
<span class="vpi-bubble-tea" />
<span class="link-text">{{ locale.sponsor }}</span>
<span class="vpi-arrow-right" />
</VPLink> -->
</div>
</template>
<style scoped>
.aside-nav-wrapper {
display: flex;
flex-direction: column;
padding: 8px 0;
margin: 16px 16px 0;
border-top: solid 1px var(--vp-c-divider);
}
.aside-nav-wrapper .link {
display: flex;
gap: 8px;
align-items: center;
font-size: 14px;
color: var(--vp-c-text-2);
transition: color var(--vp-t-color);
}
.aside-nav-wrapper .link:hover {
color: var(--vp-c-brand-1);
}
.aside-nav-wrapper .link .link-text {
flex: 1 2;
font-size: 12px;
}
.vpi-github-star {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m12 1.5l3.1 6.3l6.9 1l-5 4.8l1.2 6.9l-6.2-3.2l-6.2 3.2L7 13.6L2 8.8l6.9-1z'/%3E%3C/svg%3E");
}
.vpi-github-issue {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M8 9.5a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3'/%3E%3Cpath fill='%23000' d='M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0M1.5 8a6.5 6.5 0 1 0 13 0a6.5 6.5 0 0 0-13 0'/%3E%3C/svg%3E");
}
.vpi-bubble-tea {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m17.95 9l-1.478 8.69c-.25 1.463-.374 2.195-.936 2.631c-1.2.931-6.039.88-7.172 0c-.562-.436-.687-1.168-.936-2.632L5.95 9M6 9l.514-1.286a5.908 5.908 0 0 1 10.972 0L18 9M5 9h14m-7 0l4-7m-5.99 12h.01m1 4h.01m1.99-2h.01'/%3E%3C/svg%3E");
}
</style>

View File

@@ -1,7 +1,7 @@
---
title: 登录认证
createTime: 2025/04/23 21:03:10
headerDepth: 4
outline: [2,4]
permalink: /core/identity/
---
@@ -29,16 +29,15 @@ OpenAuth.Net支持两种登录认证方式token认证和自己搭建的OpenAu
## OpenAuth.IdentityServer认证
不同于其他项目的统一登录(如微信登录、支付宝登录等),OpenAuth.Net的统一登录指的是自己搭建一套OAuth登录服务提供给其他项目使用。即OpenAuth.IdentityServer。
当我们启动OpenAuth.WebApi/Mvc时如果IdentityServerUrl为空则采用OAuth认证
不同于其他项目的统一登录(如微信登录、支付宝登录等),OpenAuth.Net的统一登录指的是自己搭建一套OAuth登录服务提供给其他项目使用。即OpenAuth.IdentityServer。启动后,直接访问[http://localhost:12796](http://localhost:12796),效果如下:
![2025-03-18-23-12-18](http://img.openauth.net.cn/2025-03-18-23-12-18.png)
这时我们修改OpenAuth.WebApi/Mvc的IdentityServerUrl配置
```json
"IdentityServerUrl": "http://localhost:12796", //IdentityServer服务器地址。
```
这种模式下需要先启动OpenAuth.Identity项目OpenAuth.Mvc或OpenAuth.WebApi项目才能正常运行。
![2025-03-18-23-12-18](http://img.openauth.net.cn/2025-03-18-23-12-18.png)
### OpenAuth.Mvc接入
### OpenAuth.Mvc效果
当启用了Identity时mvc启动后界面如下
![2025-04-24-00-24-28](http://img.openauth.net.cn/2025-04-24-00-24-28.png)
@@ -47,13 +46,13 @@ OpenAuth.Net支持两种登录认证方式token认证和自己搭建的OpenAu
![2025-04-24-00-24-40](http://img.openauth.net.cn/2025-04-24-00-24-40.png)
### OpenAuth.WebApi接入
### OpenAuth.WebApi效果
当启用了Identity时客户端调用API需要先通过OpenAuth.IdentityServer服务器的OAuth验证才能调用接口。OpenAuth.Net调用API的客户端有两种:
当启用了Identity时客户端调用API需要先通过OpenAuth.IdentityServer服务器的OAuth验证才能调用接口。目前调用OpenAuth.WebApi的客户端有两种:
#### OpenAuth.Pro vue3
#### vue版本
在使用企业版vue界面访问OpenAuth.WebApi时已经在文件`.env.dev`中配置好相关选项,可以直接使用,无需其他处理。
在使用vue前端访问OpenAuth.WebApi时已经在文件`.env.dev`中配置好相关选项,可以直接使用,无需其他处理。
```python
VITE_OIDC_AUTHORITY = http://localhost:12796 #Identity服务器地址