Commit Graph

91 Commits

Author SHA1 Message Date
Akshay Gaikwad
9f260950af Drop KRATOS_SCHEME env var 2022-03-15 10:22: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
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
Akshay Gaikwad
a03cf171d0 Valdiate URLs in create/update OIDC provider service 2022-01-25 18:35:48 +05:30
Akshay Gaikwad
1d447cf5a9 Remove callbackURL from oidc_provider models
OIDC callback URL are Kratos url specific hence generate it
dynamically.
2022-01-25 18:35:48 +05:30
Akshay Gaikwad
3794f5e31d Update OIDC provider sync script
Trigger synchronization on PostgreSQL db notifications.
2022-01-25 18:35:48 +05:30
Akshay Gaikwad
50d1c315c9 Add OIDC providers synchronize util 2022-01-25 18:35:48 +05:30
Akshay Gaikwad
f01c3a59ae Declare baseUrl at package level 2022-01-25 18:35:48 +05:30
Akshay Gaikwad
d5b8fa3466 Implement OIDC provider Update and Delete methods 2022-01-25 18:35:48 +05:30
Akshay Gaikwad
a6e6827fac Implement create, get, list endpoint of oidc provider service 2022-01-25 18:35:45 +05:30
Akshay Gaikwad
9902eb4af0 Add organizationId and partnerId to OIDC provider model 2022-01-25 18:33:55 +05:30
Akshay Gaikwad
f93962e5f2 Add structure for OIdC provider service 2022-01-25 18:33:55 +05:30
Akshay Gaikwad
aa98bcd215 Add OIDC provider db model 2022-01-25 18:33:55 +05:30
Akshay Gaikwad
de7e491802 Add OIdC provider service API specs 2022-01-25 18:33:55 +05:30
nirav-rafay
6aeb92b0f5 Merge pull request #7 from RafaySystems/cluster-crud
initial commit for cluster management
2022-01-24 19:58:46 +05:30
nirav-rafay
1b0aa547de Merge pull request #4 from RafaySystems/init-saml
SAML based user authentication
2022-01-24 19:56:22 +05:30
Akshay Gaikwad
fc4f5802a5 Some minor modifications in the Idp service 2022-01-21 16:05:00 +05:30
Akshay Gaikwad
9f8ebe2fd8 Change name of Idp Service methods
Being consistent with other resource names.
2022-01-21 12:34:06 +05:30
nirav-rafay
0bfe13670e removed support by id and updated list cluster service 2022-01-19 18:33:47 +05:30
Akshay Gaikwad
ed0390cb8c Update Idp service according to GVK spec 2022-01-19 13:50:21 +05:30
nirav-rafay
eefb66d885 initial commit for cluster management 2022-01-19 12:42:02 +05:30