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: oidc-integration #385

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

er-santosh
Copy link

@er-santosh er-santosh commented Mar 18, 2024

Tasks done

  • Implemented Oidc Client for oidc integration.
  • Added OIDC disable feature.
  • Added Oidc session middleware.

Issue: [https://github.com//issues/237] (Support for OpenID Connect (OIDC) / OAuth2)

Tasks done
---

- Implemented Oidc Client for oidc integration.
- Added OIDC disable feature.
- Added oidc session middleware.
Copy link

vercel bot commented Mar 18, 2024

@er-santosh is attempting to deploy a commit to the Bigcapital Team on Vercel.

A member of the Team first needs to authorize it.

"socket.io": "^4.7.4",
"source-map-loader": "^4.0.1",

Choose a reason for hiding this comment

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

@er-santosh lets revert changes related to plaid and source-map-loader..as it has nothing to do with this pr

"landed_cost.dialog.label_unallocated_cost_amount":"قيمة التكلفة غير المحملة:",
"landed_cost.error.the_total_located_cost_is_bigger_than_the_transaction_line":"إجمالي قيمة التكلفة المحملة أكبر من قيمة سطر المعاملة.",
"landed_cost.dialog.label_unallocated_cost_amount": "قيمة التكلفة غير المحملة:",
"landed_cost.error.the_total_located_cost_is_bigger_than_the_transaction_line": "إجمالي قيمة التكلفة المحملة أكبر من قيمة سطر المعاملة.",

Choose a reason for hiding this comment

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

lets revert unintended changes in this file

// Set authentication cookies.
setAuthLoginCookies(data.data);

window.location.href = '/';
Copy link
Author

Choose a reason for hiding this comment

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

@abouolia Previously while logging in, the login page was reloaded after the successful login. Here in oidc login we are supposed to get code as query param in login url so we are redirecting it to '/' which is a bit static for now as reloading the route will make api call for authorization callback. Do we have any standard path that needs to be added here after login or what will be the best use case here?


// Handle logout link click.
const onClickLogout = () => {
setLogout();
Copy link
Author

Choose a reason for hiding this comment

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

@abouolia I have created custom logout hook for oidc(useAuthOidcLogout) where setLogout will be called after the oidc logout api call in both condition (error or success). Is it ok to follow this?

Comment on lines +81 to +94
export const useAuthOidcLogout = (props) => {
const apiRequest = useApiRequest();
const { setLogout } = useAuthActions();

return useMutation((values) => apiRequest.post('oidc/logout', values), {
select: (res) => res.data,
onSuccess: (data) => {
const logoutUrl = data.data.logout_url;

setLogout(logoutUrl);
},
onError: (err) => {
setLogout();
},
Copy link
Author

Choose a reason for hiding this comment

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

@abouolia Here I have implemented oidc logout such that after successful oidc login, the session end url will be passed to setLogout and redirected in same way else the normal logout will work accordingly. Is the best way to be followed?

Comment on lines +35 to +39
if (href) {
window.location.href = href;
} else {
window.location.reload();
}
Copy link
Author

Choose a reason for hiding this comment

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

@abouolia Here the only change is, if the session_end url is passed, it will be redirected to that url and gets callback from OIDC provider to post logout uri else just reload the page.

@@ -89,7 +89,7 @@ import { InvoiceChangeStatusOnMailSentSubscriber } from '@/services/Sales/Invoic
import { SaleReceiptMarkClosedOnMailSentSubcriber } from '@/services/Sales/Receipts/subscribers/SaleReceiptMarkClosedOnMailSentSubcriber';
import { SaleEstimateMarkApprovedOnMailSent } from '@/services/Sales/Estimates/subscribers/SaleEstimateMarkApprovedOnMailSent';
import { DeleteCashflowTransactionOnUncategorize } from '@/services/Cashflow/subscribers/DeleteCashflowTransactionOnUncategorize';
import { PreventDeleteTransactionOnDelete } from '@/services/Cashflow/subscribers/PreventDeleteTransactionsOnDelete'; }
import { PreventDeleteTransactionOnDelete } from '@/services/Cashflow/subscribers/PreventDeleteTransactionsOnDelete';
Copy link
Author

Choose a reason for hiding this comment

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

@abouolia I couldnot build server due to this syntax error here. So i removed it to get it working.

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.

2 participants