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: adding okta provider #1164

Merged
merged 16 commits into from
Mar 15, 2022
Merged

feat: adding okta provider #1164

merged 16 commits into from
Mar 15, 2022

Conversation

hoyyeva
Copy link
Contributor

@hoyyeva hoyyeva commented Mar 9, 2022

Summary

  • able to add okta provider from scratch
  • fix some components to be more generic
  • TODO: we will need to handle the error state (@FSHA)

Checklist

  • Wrote appropriate unit tests
  • Considered security implications of the change
  • Updated associated docs where necessary
  • Updated associated configuration where necessary
  • Change is backwards compatible if it needs to be (user can upgrade without manual steps?)
  • Nothing sensitive logged
  • Commit message conforms to Conventional Commit

Related Issues

Resolves #1064

}
`

const ExitButton = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the omission of the "o" in this file name intentional?
ExitButtn.js

return (
<ExitBtnContainer>
<Link href='/'>
<img src='/closeIcon.svg' />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to use nextjs/image in general for us where we are using Next.js:
https://nextjs.org/docs/basic-features/image-optimization

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is a good point. let me create a issue to change all the image to use nextjs/image

<ConnectProviderContainer>
<ConnectProviderContent>
<Header
header='connect identity Providers'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
header='connect identity Providers'
header='Connect Identity Providers'

const grantAdminAccess = async (userId, accesskey) => {
await axios.post('/v1/grants',
{ identity: userId, resource: 'infra', privilege: 'admin' },
{ headers: { Authorization: `Bearer ${accesskey}` } })
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might not need to set this header if they logged in using their access key already at this point. That can be in a different change tho, not related to this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, this will be removed. I already created an issue for it!
#1062

ui/.gitignore Outdated
@@ -34,4 +34,4 @@ yarn-error.log*
.vercel

# infra binary
infra
dist/*/infra
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would change to:

infra
dist

Copy link
Contributor

@jmorganca jmorganca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great first iteration

Do we need empty files? e.g. ui/components/pages/Access.js

@@ -0,0 +1,76 @@
import Router from 'next/router'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slug: /providers/add

@@ -0,0 +1,22 @@
import Link from 'next/link'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Component name: ExitButton ?

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="6" fill="none" xmlns:v="https://vecta.io/nano"><path opacity=".2" d="M.637 3l5 2.887V.113L.637 3zm13 0l-5-2.887v5.773l5-2.887zm-8.5.5h4v-1h-4v1z" fill="#fff"/></svg>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would use kebab-case instead of camelCase for these file names

@@ -0,0 +1,145 @@
import { useCallback, useState, useContext } from 'react'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make this slug /providers/add/details

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like the name, but then this page is specifically for okta setup. we will probably need to revisit this once we add more providers

@@ -0,0 +1,76 @@
import Router from 'next/router'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider slug: /providers/add/select

import Header from '../../components/Header'

const ConnectProviderContainer = styled.section`
position: relative;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future: this is an example of where tailwind could yield tighter code: className='relative'

right: .5rem;
`

const IdentitySourceList = styled.section`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename IdentitySource (and similar classes) to IdentityProvider


return (
<>
<SetupContainer>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this component reusable between other flows or should this be AddProviderContainer ?

const content = (pageType) => {
switch (pageType) {
case page.Setup:
return <Setup value={value} parentCallback={updateValue} />
Copy link
Contributor

@jmorganca jmorganca Mar 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this switch, consider making this 2 separate pages:

  • /providers/add/details (to input details)
  • /providers/add/admins (to set admins)

Then the user flow would be in order:

 /providers/add/select
/providers/add/details
/providers/add/admins

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure we want to do that? just because this flow is specifically for Okta provider. if we have any new provider, I would assume that the flow and the required setup input would be slightly different?

Copy link
Contributor Author

@hoyyeva hoyyeva Mar 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! what do you think if we can use the dynamic router for different provider? Nextjs supports dynamic routers (something like this: https://nextjs.org/docs/routing/dynamic-routes)

So in this case we will have

  • /providers/add/okta, /providers/add/google, etc (to input details)
  • and since admins should be the same page, so we can always direct them to the /providers/add/admins

so the user flow would be something like this:

/providers/add/select
[select okta]
/providers/add/okta
/providers/add/admins

/providers/add/select
[select google]
/providers/add/google
/providers/add/admins

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fantastic idea!

@hoyyeva
Copy link
Contributor Author

hoyyeva commented Mar 15, 2022

Great first iteration

Do we need empty files? e.g. ui/components/pages/Access.js

No we don't! I was adding them to prepare for working on the dashboard, but then I decided to make each page an actual page instead of components

@hoyyeva hoyyeva merged commit 4880990 into main Mar 15, 2022
@hoyyeva hoyyeva deleted the add-provider branch March 15, 2022 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

adding providers via UI
3 participants