Essentially, neetoAuth is an OAuth provider for all the neeto applications. It provides a single stop authentication solution for all the neeto applications by using the OAuth 2.0 protocol.
From the authentication perspective, neetoAuth is the main authentication application. Internally, neetoAuth uses devise, omniauth-oauth2 and doorkeeper gems to implement OAuth 2.0 authentication and Single Sign on for its neeto applications. Devise allows us to define custom oauth authentication strategy for omniauth based authentication. And neetoAuth uses the doorkeeper gem to provide a custom OAuth2.0 authentication strategy to devise (Specifics about custom authentication strategy is written below).
From the neeto application's perspective, neetoAuth's database is the source of truth for the Organization and User tables. And all applications infer Organization data, User data, API keys and other necessary data. The Organization and Users are created in each neeto application when a new organization has been created and are updated whenever any field in a row has been updated. The neeto application interfaces with neetoAuth in the following ways:
Login Flow
Sign up Flow
Creating organizations and updating information for a particular organization when data has been updated
Creating users and updating users whenever a user's profile has been updated
Fetching information about what roles are available in each neeto application
Credentials verification API for mobile
Fetching information about other neeto applications
Restricting access to a user who has not been given access for an app or the organization itself
Disabling the organization, so that the public cannot access the application
Single Sign out ( or Logout) - Which logs out the user from all the neeto application
neeto_sso gem
The neeto_sso gem is an adapter which is present in all the neeto applications so that the neeto application and neetoAuth can communicate with each other for SSO (Single Sign On), data fetching, and data synchronization.
How does OAuth 2.0 Authentication with Doorkeeper work?
Single Sign On Flow for Web
Note: If the sequence diagram is not visible in the Github README.md, the README.md with sequence diagram can viewed in VS Code with Markdown Preview Enhanced extension. Or the file can be viewed in stackedit
The following sequence diagram shows how the login strategy is handled using the OAuth2.0 protocol and Doorkeeper gem.
Login Flow for Mobile Apps
Single Logout Flow
WIP.
How does neeto_sso integrates with each neeto application and neetoAuth?