Zum Hauptinhalt springen

Kernkonzepte

Casdoor hat vier Kernobjekte: Organisationen, Benutzer, Anwendungen und Anbieter. Eine Organisation enthält Benutzer und Anwendungen. Benutzer melden sich über eine Anwendung an. Eine Anwendung nutzt Anbieter, um Anmeldeverfahren anzubieten und Nachrichten zu versenden.

Die Beispiele auf dieser Seite nutzen die Demo-Site https://door.casdoor.com.

Organisation​

Eine Organisation ist ein Container für Benutzer und Anwendungen. Eine Organisation steht typischerweise für die Mitarbeiter eines Unternehmens oder die Kunden eines Produkts. Mehrere Organisationen können sich eine Casdoor-Instanz teilen, und jede Organisation hat ihre eigenen Benutzer, Anwendungen, Passwortregeln und ihr eigenes Branding.

PropertyDescription
ownerAlways admin for organizations
nameUnique name of the organization, for example built-in
displayNameName shown in the UI
websiteUrlWebsite of the organization
passwordTypeAlgorithm used to store the passwords of the organization's users
defaultAvatarAvatar given to new users
enableSoftDeletionMarks deleted users as deleted but keeps them in the database
accountItemsFields shown on the account page of a user, and who can view and edit them

Alle Einstellungen einer Organisation finden Sie unter Organisationen.

Benutzer​

Ein Benutzer ist ein Konto, mit dem man sich anmelden kann. Jeder Benutzer gehört zu genau einer Organisation und kann sich bei jeder Anwendung dieser Organisation anmelden.

Casdoor kennt zwei Arten von Benutzern:

  • Benutzer der built-in-Organisation, wie built-in/admin: Globale Administratoren mit voller Kontrolle über die Casdoor-Instanz.
  • Benutzer anderer Organisationen, wie my-company/alice: Normale Benutzer, die sich registrieren, anmelden, abmelden und ihr eigenes Profil verwalten können.

Benutzer-IDs​

Ein Benutzer hat zwei Kennungen:

IdentifierExampleUse it for
<organization>/<username>built-in/adminCalls to the Casdoor API
idd835a48f-2e88-4c1f-b907-60ac6b6c1b40A stable user ID in your own application. It is a UUID
Tipp

Wenn Ihre Anwendung nur eine Organisation nutzt, können Sie in Ihrer Anwendung <username> allein als Benutzer-ID verwenden.

Benutzereigenschaften​

PropertyDescription
ownerName of the organization that the user belongs to
nameUsername, unique within the organization
idUUID of the user
displayNameName shown in the UI
avatarURL of the avatar image
email, phoneContact details, also used for verification codes
passwordPassword, stored in the form that the organization's passwordType defines
isAdminWhether the user is an administrator of the organization
isForbiddenWhether the user is blocked from signing in
isDeletedWhether the user is soft-deleted
signupApplicationApplication through which the user signed up
github, google, wechat, and so onID of the user at each linked identity provider
ldapID of the user in the LDAP directory that the user was synchronized from
propertiesKey-value map for your own attributes

Verwenden Sie properties für Attribute, für die Casdoor kein Feld vorsieht. Siehe Das Properties-Feld verwenden. Die vollständige Liste der Felder finden Sie unter Benutzer.

Anwendung​

Eine Anwendung ist ein Webdienst, der Benutzer über Casdoor anmeldet, beispielsweise ein Forum, ein internes Bürosystem oder ein Customer-Relationship-Management-System (CRM). Eine Anwendung gehört zu einer Organisation und hält die Einstellungen dafür bereit, wie Benutzer dieser Organisation sich bei ihr anmelden.

PropertyDescription
ownerAlways admin for applications
nameUnique name of the application, for example app-built-in
organizationOrganization whose users can sign in to the application
clientId, clientSecretOAuth 2.0 credentials of the application
redirectUrisURLs that Casdoor may send users back to after sign-in
providersProviders that the application offers on its sign-in and sign-up pages
signupItemsFields of the sign-up page
enablePasswordWhether users can sign in with a password
enableSignUpWhether new users can sign up
tokenFormatFormat of the access tokens that Casdoor issues for the application
expireInHours, refreshExpireInHoursLifetime of access tokens and refresh tokens
certCertificate that signs the tokens

Alle Einstellungen einer Anwendung finden Sie unter Anwendungskonfiguration.

Anmeldungs- und Registrierungsseiten​

Benutzer melden sich immer über eine Anwendung an. Jede Anwendung hat ihre eigenen Anmeldungs- und Registrierungsseiten. Der Root-Pfad /login ist die Anmeldungsseite von app-built-in, der Anwendung, die Casdoor für seine eigene Admin-Konsole erstellt.

AnwendungSign-up pageSign-in page
app-built-inhttps://door.casdoor.com/signuphttps://door.casdoor.com/login
app-casnodehttps://door.casdoor.com/signup/app-casnodehttps://door.casdoor.com/login/oauth/authorize?client_id=014ae4bd048734ca2dea&response_type=code&redirect_uri=http://localhost:9000/callback&scope=read&state=casdoor
app-casbin-oahttps://door.casdoor.com/signup/app-casbin-oahttps://door.casdoor.com/login/oauth/authorize?client_id=0ba528121ea87b3eb54d&response_type=code&redirect_uri=http://localhost:9000/callback&scope=read&state=casdoor

URLs für Anmeldung und Registrierung​

Um Benutzer auf die Seiten Ihrer eigenen Anwendung zu leiten, erstellen Sie die URLs selbst oder lassen Sie sie von einem SDK erstellen.

URLs selbst erstellen​

PageURL
Sign-up page of an application<casdoor-host>/signup/<application-name>
Registrierungsseite, die mit OAuth 2.0 fortfährt<casdoor-host>/signup/oauth/authorize?client_id=<client-id>&response_type=code&redirect_uri=<redirect-uri>&scope=read&state=<state>
Sign-in page of an organization<casdoor-host>/login/<organization-name>
Sign-in page that continues with OAuth 2.0<casdoor-host>/login/oauth/authorize?client_id=<client-id>&response_type=code&redirect_uri=<redirect-uri>&scope=read&state=<state>

Ein Frontend-SDK verwenden​

In React-, Vue- und Angular-Anwendungen rufen Sie getSignupUrl() und getSigninUrl() des casdoor-js-sdk auf.

Ein Backend-SDK verwenden​

In Go-, Java- und anderen Backends rufen Sie die entsprechenden Funktionen des SDKs auf, zum Beispiel GetSignupUrl() und GetSigninUrl() des casdoor-go-sdk.

Anbieter​

Ein Anbieter verbindet Casdoor mit einem externen Dienst. Casdoor federiert die Anmeldung an externe Identitätsanbieter über OAuth 2.0, OpenID Connect (OIDC) und SAML. Es nutzt auch externe Dienste, um E-Mails und SMS zu senden, Dateien zu speichern, Captchas anzuzeigen und Zahlungen entgegenzunehmen. Jede dieser Verbindungen ist ein Anbieter.

Sie erstellen einen Anbieter einmalig und fügen ihn dann den Anwendungen hinzu, die ihn nutzen.

PropertyDescription
owneradmin for a provider that all organizations share, or the name of the organization that owns it
nameUnique name of the provider
categoryKind of provider, for example OAuth, SAML, Email, SMS, Storage, Captcha, or Payment
typeService behind the provider, for example GitHub, Google, or Twilio SMS
clientId, clientSecretCredentials that the external service issues to Casdoor
host, portServer address, for example of an SMTP server
endpoint, bucket, domainLocation settings of storage providers
metadata, issuerUrlSettings of SAML identity providers

Zu jedem Anbieterkategorie- und -typ siehe Anbieter.

Integrierte Objekte​

Casdoor verwaltet sich selbst mit denselben vier Objekten. Beim ersten Start werden erstellt:

ObjectNamePurpose
Organizationbuilt-inHolds the administrators of the Casdoor instance
Userbuilt-in/adminFirst global administrator
Applicationapp-built-inThe Casdoor admin console itself

Jeder Benutzer der built-in-Organisation ist ein globaler Administrator. Um Administratoren hinzuzufügen, erstellen Sie weitere Benutzer in built-in. Um zu verhindern, dass Fremde zu Administratoren werden, deaktivieren Sie die Registrierung für app-built-in.

Vorsicht

Sie können die built-in-Organisation, den built-in/admin-Benutzer oder die app-built-in-Anwendung weder in der Admin-Konsole noch über die API umbenennen oder löschen. Ihre Namen sind hartcodiert. Das Ändern oder Entfernen in der Datenbank kann Casdoor beschädigen.

Siehe auch​