Skip to content

Commit

Permalink
Merge pull request #616 from wri/azure-returns
Browse files Browse the repository at this point in the history
Swap back to Azure SSO from Okta SSO
  • Loading branch information
luccasmmg authored Dec 18, 2024
2 parents e9981cf + c22b950 commit 6bb1d57
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 37 deletions.
6 changes: 3 additions & 3 deletions ckan-backend-dev/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ S3_BUCKET_NAME=ckan
S3_BUCKET_REGION=us-east-1
SYS_ADMIN_API_KEY=CKAN_API_TOKEN
RW_API_KEY=ffffffff-ffff-ffff-ffff-ffffffffffff
#AZURE_AD_CLIENT_ID=ffffffff-ffff-ffff-ffff-ffffffffffff
#AZURE_AD_CLIENT_SECRET=ffffffff-ffff-ffff-ffff-ffffffffffff
#AZURE_AD_TENANT_ID=ffffffff-ffff-ffff-ffff-ffffffffffff
AZURE_AD_CLIENT_ID=ffffffff-ffff-ffff-ffff-ffffffffffff
AZURE_AD_CLIENT_SECRET=ffffffff-ffff-ffff-ffff-ffffffffffff
AZURE_AD_TENANT_ID=ffffffff-ffff-ffff-ffff-ffffffffffff
SYS_ADMIN_API_KEY=CKAN_API_TOKEN
SMTP_SERVER="smtp.ssss.com"
SMTP_PORT="587"
Expand Down
6 changes: 3 additions & 3 deletions ckan-backend-dev/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ services:
- S3_BUCKET_NAME=ckan
- S3_BUCKET_REGION=us-east-1
- RW_API_KEY=${RW_API_KEY}
#- AZURE_AD_TENANT_ID=${AZURE_AD_TENANT_ID}
#- AZURE_AD_CLIENT_ID=${AZURE_AD_CLIENT_ID}
#- AZURE_AD_CLIENT_SECRET=${AZURE_AD_CLIENT_SECRET}
- AZURE_AD_TENANT_ID=${AZURE_AD_TENANT_ID}
- AZURE_AD_CLIENT_ID=${AZURE_AD_CLIENT_ID}
- AZURE_AD_CLIENT_SECRET=${AZURE_AD_CLIENT_SECRET}
- SYS_ADMIN_API_KEY=${SYS_ADMIN_API_KEY}
- SMTP_SERVER=${SMTP_SERVER}
- SMTP_PORT=${SMTP_PORT}
Expand Down
6 changes: 3 additions & 3 deletions deployment/frontend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ S3_BUCKET_REGION="us-east-1"
# LOCAL
SYS_ADMIN_API_KEY="1111"

#AZURE_AD_CLIENT_ID="ffffffff-ffff-ffff-ffff-ffffffffffff"
#AZURE_AD_CLIENT_SECRET="ffffffff-ffff-ffff-ffff-ffffffffffff"
#AZURE_AD_TENANT_ID="ffffffff-ffff-ffff-ffff-ffffffffffff"
AZURE_AD_CLIENT_ID="ffffffff-ffff-ffff-ffff-ffffffffffff"
AZURE_AD_CLIENT_SECRET="ffffffff-ffff-ffff-ffff-ffffffffffff"
AZURE_AD_TENANT_ID="ffffffff-ffff-ffff-ffff-ffffffffffff"
OKTA_CLIENT_ID="ffffffff-ffff-ffff-ffff-ffffffffffff"
OKTA_CLIENT_SECRET="ffffffff-ffff-ffff-ffff-ffffffffffff"
OKTA_ISSUER="https://example-123456.okta.com/oauth2/default"
Expand Down
6 changes: 3 additions & 3 deletions deployment/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ ARG CKAN_URL
ARG NEXT_PUBLIC_CKAN_URL
ARG NEXT_PUBLIC_NEXTAUTH_URL
ARG NEXT_PUBLIC_GTM_ID
#ARG AZURE_AD_CLIENT_ID
#ARG AZURE_AD_CLIENT_SECRET
#ARG AZURE_AD_TENANT_ID
ARG AZURE_AD_CLIENT_ID
ARG AZURE_AD_CLIENT_SECRET
ARG AZURE_AD_TENANT_ID
ARG RW_API_KEY
ARG NEXT_PUBLIC_DISABLE_HOTJAR
ARG NEXT_PUBLIC_HOTJAR_ID
Expand Down
8 changes: 4 additions & 4 deletions deployment/frontend/src/components/_shared/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function SignInForm({
<div className="text-wri-black ">or</div>
<div className="font-light text-[0.875rem] border border-1 border-wri-gray w-20 h-0" />
</div>
{/*<button
<button
type="button"
className="flex mt-8 outline outline-1 outline-wri-gold rounded-sm justify-center py-4 cursor-pointer"
onClick={handleAzureSignIn}
Expand All @@ -212,8 +212,8 @@ function SignInForm({
? 'Sign In with your WRI Credentials'
: 'Signing in...'}
</div>
</button>*/}
<button
</button>
{/*<button
type="button"
className="flex mt-8 outline outline-1 outline-wri-gold rounded-sm justify-center py-4 cursor-pointer"
onClick={handleOktaSignIn}
Expand All @@ -227,7 +227,7 @@ function SignInForm({
? 'Sign In with your WRI Credentials'
: 'Signing in...'}
</div>
</button>
</button>*/}
</>
)
}
Expand Down
12 changes: 6 additions & 6 deletions deployment/frontend/src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export const env = createEnv({
(str) => process.env.SYS_ADMIN_API_KEY ?? str,
z.string()
),
//AZURE_AD_TENANT_ID: z.string(),
//AZURE_AD_CLIENT_ID: z.string(),
//AZURE_AD_CLIENT_SECRET: z.string(),
AZURE_AD_TENANT_ID: z.string(),
AZURE_AD_CLIENT_ID: z.string(),
AZURE_AD_CLIENT_SECRET: z.string(),
OKTA_CLIENT_ID: z.string(),
OKTA_CLIENT_SECRET: z.string(),
OKTA_ISSUER: z.string(),
Expand Down Expand Up @@ -79,9 +79,9 @@ export const env = createEnv({
S3_BUCKET_NAME: process.env.S3_BUCKET_NAME,
S3_BUCKET_REGION: process.env.S3_BUCKET_REGION,
SYS_ADMIN_API_KEY: process.env.SYS_ADMIN_API_KEY,
//AZURE_AD_TENANT_ID: process.env.AZURE_AD_TENANT_ID,
//AZURE_AD_CLIENT_ID: process.env.AZURE_AD_CLIENT_ID,
//AZURE_AD_CLIENT_SECRET: process.env.AZURE_AD_CLIENT_SECRET,
AZURE_AD_TENANT_ID: process.env.AZURE_AD_TENANT_ID,
AZURE_AD_CLIENT_ID: process.env.AZURE_AD_CLIENT_ID,
AZURE_AD_CLIENT_SECRET: process.env.AZURE_AD_CLIENT_SECRET,
OKTA_CLIENT_ID: process.env.OKTA_CLIENT_ID,
OKTA_CLIENT_SECRET: process.env.OKTA_CLIENT_SECRET,
OKTA_ISSUER: process.env.OKTA_ISSUER,
Expand Down
29 changes: 14 additions & 15 deletions deployment/frontend/src/server/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,17 @@ export const authOptions: NextAuthOptions = {
// token.teams = user.teams
token.sysadmin = user.sysadmin
}
//let isAzureAd = account?.provider === 'azure-ad'
let isAzureAd = account?.provider === 'azure-ad'
let isOkta = account?.provider === 'okta'
//if (isAzureAd || isOkta) {
if (isOkta) {
if (isAzureAd || isOkta) {
const reqBody: any = {
email: user?.email,
name: user?.name,
id_token: account?.id_token,
}
//if (isAzureAd) {
// reqBody.from_azure = true
//}
if (isAzureAd) {
reqBody.from_azure = true
}
if (isOkta) {
reqBody.from_okta = true
}
Expand Down Expand Up @@ -194,16 +193,16 @@ export const authOptions: NextAuthOptions = {
}
},
}),
//AzureAdProvider({
// clientId: env.AZURE_AD_CLIENT_ID ?? '',
// clientSecret: env.AZURE_AD_CLIENT_SECRET?.toString() ?? '',
// tenantId: env.AZURE_AD_TENANT_ID ?? '',
//}),
OktaProvider({
clientId: env.OKTA_CLIENT_ID ?? '',
clientSecret: env.OKTA_CLIENT_SECRET?.toString() ?? '',
issuer: env.OKTA_ISSUER ?? '',
AzureAdProvider({
clientId: env.AZURE_AD_CLIENT_ID ?? '',
clientSecret: env.AZURE_AD_CLIENT_SECRET?.toString() ?? '',
tenantId: env.AZURE_AD_TENANT_ID ?? '',
}),
//OktaProvider({
// clientId: env.OKTA_CLIENT_ID ?? '',
// clientSecret: env.OKTA_CLIENT_SECRET?.toString() ?? '',
// issuer: env.OKTA_ISSUER ?? '',
//}),
],
}

Expand Down

0 comments on commit 6bb1d57

Please sign in to comment.