Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: login / logout with oidc #11

Merged
merged 5 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
# production
/build

# dev
.env.development

# misc
.DS_Store
*.pem
Expand Down
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
Console to let user manage their AI agents for their preference.
* Add existing agent
* Build your own AI agent
* Chat with agents
* Keep chat history
* ..

- Add existing agent
- Build your own AI agent
- Chat with agents
- Keep chat history
- ..

## Environment
- node >= v18.17.0

- node >= v18.17.0

## Getting Started

Expand All @@ -22,5 +24,15 @@ pnpm dev
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
Open <http://localhost:3000> with your browser to see the result.

## Development OIDC 配置

根目录新建 `.env.development`

```
OIDC_SERVER_URL=[OIDC_SERVER_URL]
CLIENT_ID=[CLIENT_ID]
CLIENT_SECRET=[CLIENT_SECRET]
CLIENT_REDIRECT_URI=[CLIENT_REDIRECT_URI]
```
11 changes: 11 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

import config from './src/config/oidc.mjs';
const oidcUrl = config.server.url;
const isProd = process.env.NODE_ENV === 'production';

const nextConfig = {
Expand All @@ -24,6 +26,15 @@ const nextConfig = {
},
reactStrictMode: true,
transpilePackages: ['antd', '@ant-design', 'antd-style', '@lobehub/ui', 'antd-mobile'],
// async rewrites() {
// return [
// {
// source: '/oidc/token',
// destination: `${oidcUrl}/oidc/token`,
// secure: false,
// },
// ]
// },
webpack: (config) => {
config.experiments = {
asyncWebAssembly: true,
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "0.1.0",
"scripts": {
"build": "next build",
"dev": "next dev",
"dev": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 next dev",
"dev-https": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 next dev --experimental-https --experimental-https-key ./cert/key.pem --experimental-https-cert ./cert/cert.pem",
"lint": "npm run lint:es && npm run lint:style",
"lint-fix": "npm run lint-fix:es && npm run lint-fix:style",
"lint-fix:es": "eslint --ext .jsx,.js,.tsx,.ts src --fix",
Expand Down Expand Up @@ -50,6 +51,7 @@
"classnames": "^2.5.1",
"lucide-react": "^0.304.0",
"next": "14.0.4",
"query-string": "^8.1.0",
"react": "^18",
"react-dom": "^18",
"react-layout-kit": "^1.7.4",
Expand All @@ -60,16 +62,20 @@
"devDependencies": {
"@types/mdx": "^2.0.10",
"@types/node": "^20",
"@types/query-string": "^6.3.0",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/ua-parser-js": "^0.7.39",
"@yuntijs/lint": "^1.4.0",
"commitlint": "^18.4.3",
"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"eslint-config-next": "14.0.4",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"prettier": "^3.1.1",
"remark": "^15.0.1",
"remark-cli": "^12.0.0",
"stylelint": "^15",
"typescript": "^5"
},
Expand Down
Loading
Loading