Code Monkey home page Code Monkey logo

casdoor / casdoor Goto Github PK

View Code? Open in Web Editor NEW
8.6K 63.0 1.0K 32.41 MB

An open-source UI-first Identity and Access Management (IAM) / Single-Sign-On (SSO) platform with web UI supporting OAuth 2.0, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, Face ID, RADIUS, Google Workspace, Active Directory and Kerberos

Home Page: https://casdoor.org

License: Apache License 2.0

Go 98.81% HTML 0.44% CSS 0.07% Less 0.16% Dockerfile 0.14% Makefile 0.32% Shell 0.05%
oidc sso oauth casdoor iam go react saml webauthn ldap mfa totp payment-gateway single-sign-on radius scim active-directory casbin kerberos faceid

casdoor's Introduction

📦⚡️ Casdoor

An open-source UI-first Identity and Access Management (IAM) / Single-Sign-On (SSO) platform with web UI supporting OAuth 2.0, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA and RADIUS

semantic-release docker pull casbin/casdoor GitHub Workflow Status (branch) GitHub Release Docker Image Version (latest semver)

Go Report Card license GitHub issues GitHub stars GitHub forks Crowdin Discord

Sponsored by

Build auth with fraud prevention, faster.
Try Stytch for API-first authentication, user & org management, multi-tenant SSO, MFA, device fingerprinting, and more.

Online demo

Documentation

https://casdoor.org

Install

How to connect to Casdoor?

https://casdoor.org/docs/how-to-connect/overview

Casdoor Public API

Integrations

https://casdoor.org/docs/category/integrations

How to contact?

Contribute

For casdoor, if you have any questions, you can give Issues, or you can also directly start Pull Requests(but we recommend giving issues first to communicate with the community).

I18n translation

If you are contributing to casdoor, please note that we use Crowdin as translating platform and i18next as translating tool. When you add some words using i18next in the web/ directory, please remember to add what you have added to the web/src/locales/en/data.json file.

License

Apache-2.0

casdoor's People

Contributors

abingcbc avatar anyidea avatar baihhh avatar chinoholo0807 avatar cofecatt avatar comradeprogrammer avatar dacongda avatar ebreak avatar erikqqy avatar forestmgy avatar github-actions[bot] avatar hgz-20 avatar hsluoyz avatar imchell avatar imp2002 avatar leo220yuyaodog avatar nekotoxin avatar nomeguy avatar notdu avatar outofeastgate avatar qianxi0410 avatar resulte avatar selflocking avatar seriouszyx avatar sh1luo avatar sp71 avatar steve0x2a avatar turbodog03 avatar usherfall avatar xdtd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

casdoor's Issues

Website Reloads on routing

Everywhere in the project, hrefs are given which reloads the website every time someone navigates. It needs to be corrected and instead, Links from react-router-dom should be used.
I am willing to work on the same and few other aspects of the project Casdoor

frontend bug:unable to display in the Safari browser

image

image

image

Unable to display properly in the Safari browser.
os:Mac 11.4 (20F71),Ios 14.6.
safari version:14.1.1 (16611.2.7.1.4)
ua: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15

How/where do we edit and manage policies?

In the Admin Portal page, it mentions: "We provide a web-based portal called Casdoor for model management and policy management:"_ but after installing and running casdoor I cannot find any option to access a policy editor, nor do I need any source code related to that topic in the repository.
How/where we edit and manage policies?

Support Time-based One Time Password (TOTP) for push notification (e.g., via Google Authenticator)

See: https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en_US&gl=US

When user logs into an application, after password passes, he also needs to input the dynamic code in Authenticator apps like Google Authenticator: https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en_US&gl=US

image

The existing work include:

We need someone to conclude it.

role graph serialization for front-end usage

Screenshot from 2020-05-26 22-49-02

I have a covid-19 project which shows virus propagation chain, so I came up with a small idea of serializing role links which can be useful for analyzing.

basically the serialized json should be similar to the following to be used by frontend libraires such as d3.js

{
  name: "alice",
  children: [
    {
       name: "bob",
       children: [
         {
            name: "eve".
            children: []
         }
       ]
    }
  ]
}

Integrate an OAuth provider (server-side)

Casdoor acts like both a OAuth client and OAuth server:

  1. For the Casdoor user applications (e.g., a forum or a blog system that uses Casdoor to manager login and permissions), Casdoor will behave as the OAuth service providers.
  2. For real 3rd-party identity providers like Gmail, Google, WeChat, Casdoor will act as an OAuth client.

We need to choose which lib in Golang for both OAuth client and server-side.

Technology selection of frontend an backend

Technology selection is an important part of the project, and in order to reach an agreement with all developers, I created a list for discussion.

Frontend

Language

TypeScript - Provides strict code checking to make our application more stable.

User interfaces

React - A JavaScript library for building user interfaces.
Ant Design - A UI Design Language and React UI library.
React-Router - Declarative routing for React.

HTTP client

axios - Provides easy API and rich features.

Easy API

GET

axios.get("/things").then((res) => console.log(res.data))

POST

const data = {id: 1}
axios.post("/things", data).then(res => console.log(res.data))

Features - HTTP interceptors

axios.interceptors.request.use(config => {
  // log a message before any HTTP request is sent
  console.log('Request was sent');

  return config;
});

// sent a GET request
axios.get('/things')
  .then(response => {
    console.log(response.data);
  });

axios or fetch: Which should you use? https://blog.logrocket.com/axios-or-fetch-api/

Backend

Language

Go 1.15

Web framework

I recommend using Gin or chi more than Beego.

Beego is very powerful, but I prefer Gin or chi.

The API provided by Gin and chi looks very clear. It's also great in terms of performance.

chi is library, it's really cool and fast :)

Database

PostgreSQL

Add auditing functionality

We should record all user behaviors (including normal user login, logout and admin user using the Casdoor portal) into the audit logs. We should provider an interface design, so people can choose logging into file, DBs or Elasticsearch, etc. Each logger will provide a logging destination.

Add Casbin model and policy management

See: #37

We once developed two similar systems: Casbin-Dashboard and Casbin-Cloud, but both projects failed finally. You can just grap some inspirations from them:

Casbin-Dashboard

  1. Source code: https://github.com/casbin/casbin-dashboard
  2. Online demo: https://dashboard.casbin.org/

Casbin-Cloud

  1. Source code: https://github.com/casbin/openstack-policy-editor
  2. Online demo: https://cloud.casbin.org/

However, don't copy them, because they have failed and I don't think their designs are good. Just use them as reference and starting point to understand this area.

npm ERR! cb() never called!

OS:windows 7
node.js:v13.14.0
npm:6.14.4

D:\proj\casdoor\web>npm install
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: babel-eslint is now @babel/eslint-parser. This package will
 no longer receive updates.
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 1
5x less dependencies.
npm WARN deprecated @types/[email protected]: This is a stub types definition. testing-libr
ary__dom provides its own type definitions, so you do not need this installed.
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure
binaries. Upgrade to fsevents 2.
npm WARN deprecated @hapi/[email protected]: Switch to 'npm install joi'
npm WARN deprecated [email protected]: This package has been deprecated and is no longer mai
ntained. Please use @rollup/plugin-babel.
npm WARN deprecated @hapi/[email protected]: Moved to 'npm install @sideway/address'
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported
or maintained
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or
 maintained
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or
 maintained
npm WARN deprecated [email protected]: core-js@<3.3 is no longer maintained and not recommended for usa
ge due to the number of issues. Because of the V8 engine whims, feature detection in old core-js ver
sions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependen
cies to the actual version of core-js.
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\nodejs\node_cache\_logs\2021-06-20T02_01_53_661Z-debug.log

2021-06-20T02_01_53_661Z-debug.log

35497 http fetch GET 200 https://cdn.npm.taobao.org/axe-core/-/axe-core-4.2.2.tgz 99525ms
35498 silly extract axe-core@^4.0.2 extracted to D:\proj\casdoor\web\node_modules\.staging\axe-core-17c23a5f (112012ms)
35499 silly extract core-js@^2.4.0 extracted to D:\proj\casdoor\web\node_modules\.staging\core-js-6a4d047d (125777ms)
35500 silly extract core-js-pure@^3.14.0 extracted to D:\proj\casdoor\web\node_modules\.staging\core-js-pure-bfb8da57 (137299ms)
35501 silly extract core-js@^3.6.5 extracted to D:\proj\casdoor\web\node_modules\.staging\core-js-305ffa3a (137036ms)
35502 silly extract @ant-design/icons-svg@^4.0.0 extracted to D:\proj\casdoor\web\node_modules\.staging\@ant-design\icons-svg-0cfbf6e2 (470850ms)
35503 silly extract @ant-design/icons@^4.6.2 extracted to D:\proj\casdoor\web\node_modules\.staging\@ant-design\icons-0de0d813 (302937ms)
35504 silly extract date-fns@^2.15.0 extracted to D:\proj\casdoor\web\node_modules\.staging\date-fns-51c0fbb4 (182906ms)
35505 timing npm Completed in 518709ms
35506 error cb() never called!
35507 error This is an error with npm itself. Please report this error at:
35508 error <https://npm.community>

Frontend : Modularizing Components and Make them responsive

The current folder structure is highly disorganized and hard to navigate. Many components can be modularized which will in turn reduce the amount of code drastically.
I am proposing following folder structure
--| src
--|--| assets
--|--|--| logo.png
--|--| components
--|--|--| CustomGithubCorner.js
--|--|--| Footer.js
--|--|--| Navbar.js
--|--|--| SelectLanguageBox.js
--|--|--| AuthProvider.js
--|--|--| Face.js
--|--|--| Utils.js
--|--| pages
--|--|--| AccountPage.js
--|--|--| ApplicationEditPage.js
--|--|--| ApplicationListPage.js
--|--|--| HomePage.js
--|--|--| LoginPage.js
--|--|--| OrganizationEditPage.js
--|--|--| OrganizationListPage.js
--|--|--| ProviderEditPage.js
--|--|--| ProviderListPage.js
--|--|--| TokenEditPage.js
--|--|--| TokenListPage.js
--|--|--| UserEditPage.js
--|--|--| UserListPage.js
--|--| config
--|--|--| Conf
--|--| locale
--|--|--| en.json
--|--|--| zh.json
--|--| backend
--|--|--| Auth.js
--|--|--| AuthBackend.js
--|--|--| AuthCallback.js
--|--|--| ApplicationBackend.js
--|--|--| OrganizationBackend.js
--|--|--| ProviderBackend.js
--|--|--| TokenBackend.js
--|--|--| UserBackend.js

Allow me to work on it... will be done in 2 days.

calling "api/register" even with correct data feilds gives error

I called "api/register" with following json object
{ "owner" : "builtin", "username" : "sourabh", "password" : "123", "name" : "sourabh mandal", "email" : "[email protected]", "phone" : "999" }
But I got the following error

a

The GetOwnerAndNameFromId() expect a username : "sourabh/organization

The route works fine when I pass following payload
{ "owner" : "builtin", "username" : "sourabh/organisation", "password" : "123", "name" : "sourabh mandal", "email" : "[email protected]", "phone" : "999" }

Please tell me if its an error in CODE or the JSON PAYLOAD

Provide our Go backend API docs (via Swagger) in the web portal

We use Beego as the backend web framework. Beego has a good integration for automated API docs like Swagger: https://beego.me/docs/advantage/docs.md

We need to integrate it and show a "Swagger" button in the top NavBar, the user can click into the API docs page and know what API we have provided in: https://github.com/casbin/casdoor/blob/master/routers/router.go , so they can directly call Casdoor via API instead of the frontend.

The finished Swagger UI would be something like: https://petstore.swagger.io/ , but it will be hosted directly in our Go backend (like: https://door.casbin.com/swagger).

image

Maybe we also need to add comments to our public API functions, so the API docs can be generated.

A suggestion for README.md

Should we tell our users in the paragraph Installation to proxy the URL https://(hostname)/api/ to http://localhost:8000 in their servers?

Act as an OAuth 2.0 + OIDC server

Currently, Casdoor uses a home-made logging-in mechanism: https://github.com/casbin/casdoor/blob/master/controllers/account.go

It's not standard and it's unsafe, the password is transmitted over the network.

Finally, we will move to OAuth 2.0 + OIDC. It means that applications like Casbin OA (both JS client and Go backend) will talk to Casdoor via the OAuth 2.0 + OIDC protocols.

We can use: https://github.com/go-oauth2/oauth2 to implement our OAuth 2.0 + OIDC server-side.

The existing code:

  • Casdoor JS client SDK: https://github.com/casbin/casbin-oa/tree/master/web/src/auth (currently for agile development, we put the code inside Casbin-OA, so we don't need to publish to NPM then import it in dependency file. In future, when the API is stablized, we will separate the Casdoor JS client code into a new repo and release to NPM)
  • Casdoor Go SDK: not available yet, because currently Casbin-OA doesn't involve any server-side code to talk to Casdoor, only client does. This is NOT correct. So we will formulate a Go SDK in the Casbin-OA Go code.

Some reference about this topic: #10

Make "Auto login" button work

Current it doesn't work:

image

We may:

  1. If it is not ticked, we only save the session for 1 day at server-side.
  2. If it is ticked, the same as now.

/api/register not working properly

while running this project in localhost I got this error which is due to func GetOwnerAndNameFromId() from util/string.go

image

My API call is as follows :
POST http://localhost:8000/api/register
req.body =>
{ "username" : "sourabh", "password" : "pass1" }

image

Here I haven't passed anything other than username and password in JSON payload

Making changes in func GetOwnerAndNameFromId() resolved this issue

Starting port is 3000, not 7001

The README says it would start at 7001, and package.json does use "start": "set PORT=7001 && craco start", but after start via npm or yarn, it starts at 3000.

Yarn start get empty content.

When start via yarn run start, the page is empty.

But start with npm run start, it's ok.

And, after start via npm once, then start via yarn, the issue is gone.

Not sure what happened.

yarn version -> 1.22.10,
npm version -> 6.14.11,
node version -> v12.22.0,

Chrome version -> Version 88.0.4324.182 (Official Build) (64-bit) on Linux (mint mate 20, based on ubuntu).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.