Skip to content

Commit

Permalink
chore: updated iaaa compat (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
thezzisu authored Sep 1, 2024
1 parent 1f3bba2 commit dc5a651
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .yarn/versions/29701c61.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases:
"@aoi-js/server": patch
22 changes: 22 additions & 0 deletions apps/server/src/routes/oauth/iaaaCompat.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
import { fastifyFormbody } from '@fastify/formbody'
import { UUID } from 'mongodb'

import { T } from '../../schemas/common.js'
import { defineRoutes, md5, swaggerTagMerger } from '../common/index.js'

export const oauthIaaaCompatRoutes = defineRoutes(async (s) => {
await s.register(fastifyFormbody)

const { users, apps } = s.db

s.addHook('onRoute', swaggerTagMerger('iaaa-compat'))

if (!Object.hasOwn(s.authProviders, 'iaaa')) return

s.get(
'/oauth.jsp',
{
schema: {
body: T.Object({
appID: T.String(),
appName: T.String(),
redirectUrl: T.String()
})
}
},
async (req, rep) => {
const url = new URL('/oauth/authorize', req.originalUrl)
url.searchParams.set('client_id', req.body.appID)
url.searchParams.set('redirect_uri', req.body.redirectUrl)
return rep.redirect(307, url.toString())
}
)

s.get(
'/svc/token/validate.do',
{
Expand Down

0 comments on commit dc5a651

Please sign in to comment.