Commit Graph

109 Commits

Author SHA1 Message Date
Abin Simon
7189ae0fbe Fix missing soft_delete handling 2022-03-18 12:06:50 +05:30
nirav-rafay
357f53ff29 Merge pull request #67 from RafaySystems/fix-66
Fix race condition between kratos-migrate and migrate-admindb
2022-03-17 12:42:06 +05:30
Akshay Gaikwad
14ef1afd00 Fix race condition between kratos-migrate and migrate-admindb
migrate-admindb service in docker compose must require all kratos
migrations to be completed, otherwise it fails with some-kratos-table
not exists error.

Fix #66

Signed-off-by: Akshay Gaikwad <akshay.gaikwad@rafay.co>
2022-03-16 18:50:45 +05:30
abin-rafay
bb3d785756 Merge pull request #62 from RafaySystems/transactions
Transactions - Part 1
2022-03-16 17:12:25 +05:30
Abin Simon
df810ab45a Convert from dao interface to funcs
This was done inorder to support transactions which will be done in
the next PR. This is the first step towards that.
2022-03-16 17:10:32 +05:30
Abin Simon
226b753938 Switch to using soft delete for resources 2022-03-16 17:10:32 +05:30
abin-rafay
01ea6bb3f5 Merge pull request #61 from RafaySystems/soft-delete
Switch to using soft delete for resources
2022-03-16 17:09:59 +05:30
Abin Simon
6a72c96fba Update tests for soft delete 2022-03-16 17:09:12 +05:30
Abin Simon
022dedfbdf Switch to using soft delete for resources 2022-03-16 17:09:10 +05:30
nirav-rafay
9bb6285453 Merge pull request #57 from RafaySystems/deployment-udpate
Clean up env variables
2022-03-16 16:57:39 +05:30
nirav-rafay
8d2049ba53 Merge pull request #56 from RafaySystems/initialization
Initialization script
2022-03-16 16:54:24 +05:30
Abin Simon
701ab5c536 Switch to fetching all needed values via named cli args 2022-03-15 13:34:47 +05:30
Akshay Gaikwad
9f260950af Drop KRATOS_SCHEME env var 2022-03-15 10:22:09 +05:30
Abin Simon
98ac0c4bbc Restructure initialization code 2022-03-14 18:12:20 +05:30
abin-rafay
4993509798 Add db local setup instructions and some cleanup in README (#51) 2022-03-14 17:51:09 +05:30
Akshay Gaikwad
b0d2df72f4 Clean up env variables
- Removed unnecessary env vars.
- Add all env vars to env.example file.
2022-03-14 15:13:28 +05:30
Abin Simon
bc19970395 Allow creation of initial org admin user 2022-03-14 12:34:20 +05:30
Abin Simon
3aedac3201 Fix scope for roles
This might not really be necessary but a good check
2022-03-14 12:34:18 +05:30
Abin Simon
8184c23a8f Initialize script to create org, partner and roles
We should probably have the role creation moved into adminsrv, but
since we are only creating new orgs like this as of now let us
continue with this.
2022-03-14 12:33:19 +05:30
Abin Simon
b049ebaf28 Delete a duplicate entry from json data for role 2022-03-14 12:33:19 +05:30
nirav-rafay
d469315bad changes for cli config download, apikey services and cli auth verify (#55) 2022-03-11 20:06:55 +05:30
abin-rafay
bef3d9ed53 When adding users to group drop duplicate users (#50) 2022-03-11 17:36:56 +05:30
akshay196-rafay
5429bf4493 Add Docker compose file (#49)
* Add DB_ADDR to env vars list
* Add Dockerfile and docker-compose
* Remove go.mod from _kratos dir and clean go.mod of root dir
* Run Kratos docker-compose quickstart from root dir
* Add gomigrate to docker-compose
* Bump docker-composen version to 3.7
* Add Kratos services in the single docker compose file
Removed Kratos quickstart files and merge all setup required for
rcloud-base in the kratos-compose.yml file located in the root of the
repo.
* Add elasticsearch in docker-compose
* Allow es to not be available in when in dev mode
* Change default ES endpoint

Co-authored-by: Abin Simon <abin.simon@rafay.co>
2022-03-11 17:28:16 +05:30
akshay196-rafay
d36f14e407 Add LICENSE (#48) 2022-03-11 17:24:50 +05:30
abin-rafay
0e9be5e589 Audit engine query endpoints (#43) 2022-03-08 16:44:41 +05:30
akshay196-rafay
7938f30668 Update IdP and OIDC Provider (#40)
* Update creating oidc provider

* Validate partner and organization by checking in db tables.

* Validate empty scopes

* Fix oidc provider update

* Fix application Host url in ACS URL of Idp
2022-03-07 19:06:57 +05:30
akshay196-rafay
274cfe7c4f Improve Auth module (#36)
* Expose NewSessionContext function

When auth middleware or interceptor is being mocked by other service
then they can take help of `session.NewSessionContext` to store mocked
session data to request context.

* Initialize _log in auth at creating

* Allow excluding URLs in Auth middleware
2022-03-07 16:40:03 +05:30
nirav-rafay
c66bdc25cd restructure rcloud-base as a single base controller (#37)
* restructure rcloud-base as a single base controller
* updated master.rest
* moved sentry from internal to pkg as it is used by relay
* removing unused rpc and it's dependencies
* Fix usermgmt tests
* Don't redefine variables in rest file
Co-authored-by: Abin Simon <abin.simon@rafay.co>
2022-03-03 17:59:06 +05:30
akshay196-rafay
4ff3d06ef7 Move audit package from rafay-common (#33)
* Move audit package from rafay-common
* Change import from rafay-common to rcloud-base
* GetEvent() now takes projectID as a string parameter.
2022-03-01 17:13:49 +05:30
nirav-rafay
3a8658ad0f added test cases and improved coverage (#32)
* added test cases and improved coverage
* aligned usermgmt project structure
* move all proto to rcloud-base common
2022-03-01 11:48:56 +05:30
nirav-rafay
46cf76db9f issue fixes while testing getauthz and relay-agent-config gen format fix (#29)
* issue fixes while testing getauthz and relay-agent-config gen format fix
* addressed review comments and added idp table migrations
2022-02-25 17:36:37 +05:30
abin-rafay
cba4bd226c Properly update group on user removal (#31)
* Regenerate stale idp swagger definitions
* Remove an unnecessary import
* Handle err case for role not found in db
* Fix user not being deleted in casbin on user remove from group
2022-02-25 17:35:51 +05:30
akshay196-rafay
269bffea29 Add setup Kratos for development guide (#23) 2022-02-25 12:20:43 +05:30
akshay196-rafay
297bbcd82f Merge pull request #27 from RafaySystems/auth-middleware
Add authentication middleware
2022-02-25 10:41:45 +05:30
Akshay Gaikwad
ff7bbec976 Add authentication middleware 2022-02-24 13:56:46 +05:30
akshay196-rafay
a2f03c60da Authentication interceptor (#14)
Changes in this PR include
- Authenticate gRPC requests
- Initial file structure for authentication and authorization service
- Use Auth middleware and interceptor service in usermgmt component
- Authenticate HTTP request based on Kratos API token
- Add Auth middleware to adminsrv component
- Name the Grpc metadata fields
- Maintain session data after authentication
- Removed http middleware as it is not necessary
- Exclude rpc methods from authentication
- Handle error in auth interceptor
- Revert to with cancel context
- Log authentication failed requests and New function in authv3
- Initiate authContext struct in authv3 package using new public
- function NewAuthContext.
2022-02-23 11:18:49 +05:30
nirav-rafay
ac594927a6 initial commit for relay (#17)
initial commit for relay
2022-02-22 11:42:15 +05:30
nirav-rafay
f4bd2a802d initial commit for sentry related changes (#16) 2022-02-22 11:41:48 +05:30
abin-rafay
35edd2dee5 Authz integration for usermgmt (#19)
* Update dependencies from authz
* authz: fix log import path
* Authz related creation steps
* Fix typo: Namesapce -> Namespace
* Add tests for role creation interaction with authz
* Switch to using names for policy and group creation in authz
* Group creation not udpates casbin db
* Fix reading db address from env
* Tiny typo fix in readme
* Simplify error handling in usermgmt server
* Rework test setup
* Fix all current tests
* Complete authz integration
* Drop unnecessary dependency on adminsrv in usermgmt
2022-02-21 17:11:11 +05:30
akshay196-rafay
8990aa8942 Change IdP and OIDC Provider lookup to name from Id (#18)
* Move oidc provider model

* Change apiVersion of Idp and Oidc provider to 'system.k8smgmt.io/v3'

* Change IdP Get, Udpate, Delete to name instead of an Id

* Change Oidc Provider Get, Update, Delete to name instead of an Id

* Deprecated AcsURL from Idp db table

AcsURL is generated dynamically per request. This change is made
particularly considering case where application host is changed after
adding IdP. Storing AcsURL in table will create hard coupling between
application host and Idp configuration. OIDC provider service is
following same approach for callback url.

* Idp: Load application HTTP Url in main.go

* OIDC Provider: Reuse Kratos Url from main.go
2022-02-21 16:58:10 +05:30
abin-rafay
2275d500ed Merge pull request #15 from RafaySystems/authz
Authz: Fix Delete methods
2022-02-15 19:27:26 +05:30
shrey-rafay
163346d049 Fix Delete methods 2022-02-11 13:40:34 +05:30
shrey-rafay
2cbe856c5b Refactored the entirety of it 2022-02-11 13:40:29 +05:30
shrey-rafay
4e3653cc65 Inital commit for authz server 2022-02-11 13:37:00 +05:30
abin-rafay
4fc8e39687 Few fixes in usermgmt (#13)
* Drop Id and modifiedAt for resource permissions

* Add apiVersion and Kind to GET reponses

* projectnamespaceroles -> projectNamespaceRoles
2022-02-08 16:01:23 +05:30
shrey-rafay
3e5ea03bfc Authentication Server (#9)
* Inital commit for authz server
* Review Changes, mostly RolePermissionMappings
2022-02-07 11:21:55 +05:30
abin-rafay
27085b1ee1 Add generated files for OIDC proto definitions (#11) 2022-02-03 11:56:06 +05:30
abin-rafay
464a1014db User management (#8)
multiple fixes and refactored to support from id to name, added resource roles, permissions script and improved test coverage
2022-02-03 11:04:01 +05:30
nirav-rafay
a4af8dae6e Merge pull request #10 from RafaySystems/oidc-init
Support for OIdC authentiation
2022-02-01 16:06:16 +05:30
Akshay Gaikwad
9b831d56b7 Moved oidc provider triggers sql file to migrations 2022-02-01 13:39:46 +05:30