Commit Graph

70 Commits

Author SHA1 Message Date
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
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
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
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
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
Akshay Gaikwad
ad3cbc10d3 Convert Idp API spec to GVK style 2022-01-19 12:38:09 +05:30
Akshay Gaikwad
c1ba133383 Register IdpService in main.go and minor changes in Idp model 2022-01-18 18:07:17 +05:30
Akshay Gaikwad
d794603d7f Add DeleteIdp rpc method
Signed-off-by: Akshay Gaikwad <akshay.gaikwad@rafay.co>
2022-01-17 13:12:25 +05:30
Akshay Gaikwad
2ef237dac5 Add IdP swagger details and HTTP endpoints to RPCs
Signed-off-by: Akshay Gaikwad <akshay.gaikwad@rafay.co>
2022-01-17 12:41:39 +05:30
Akshay Gaikwad
8464307c1e SAML Authentication and IDP Service
Initial SAML based authentication in usermgmt component

Signed-off-by: Akshay Gaikwad <akshay.gaikwad@rafay.co>

Update SAMLAuth middleware

- Get username from request body
- Validate for exiwstng session
- Redirect to IDP authentication when no valid session

Modification in SAML middlewares

- Reduce duplicate code by new function createSAMLMiddleware

Restructure saml package

- Moved SAML Middlewares to middleware.go
- Embed samlsp.Middleware into own struct

Use EntityDAO from common and mock Idp model for testing

Signed-off-by: Akshay Gaikwad <akshay.gaikwad@rafay.co>

Add IDP API definitions

Signed-off-by: Akshay Gaikwad <akshay.gaikwad@rafay.co>

Add interface for IdpService

Add id to UpdateIdp proto message

Add metadata_url to UpdateIdp message and limit to ListIdps rpc

Implement Idp Service methods

Update Idp model

Remove main.go and mocked idp model

Generate ACS URL and SAML SP cert

Change Id type in proto as well as in IDP model

Update IDP model struct tags

Set TimeFormat for IDP service

Update generateSpCert() and generateAcsURL()

Add idpServer which is wrapper around idpService

idpServer is a gRPC controller.

Add back-end validations for idp service
2022-01-17 11:29:55 +05:30
Abin Simon
64a70363db Simplify server package for usermgmt 2022-01-13 10:29:54 +05:30
Abin Simon
ca11e2bd9b Updated rest examples file 2022-01-13 10:18:56 +05:30
Abin Simon
0aef2df882 Few tweaks on resource response on success 2022-01-13 10:18:56 +05:30
Abin Simon
f2124caf28 User spec can now specify the groups a user belongs to 2022-01-12 17:35:38 +05:30
Abin Simon
9a189f4bb6 Return updated status back to client on error 2022-01-12 17:35:38 +05:30
Abin Simon
dca468292d Revert bun version to 1.0.20
1.0.21 was returning `0` for the ids after insertion
2022-01-12 17:35:38 +05:30
Abin Simon
7bbc1541f8 Set Trash colums in models to default to false 2022-01-12 17:35:38 +05:30
Abin Simon
4e77e0495c Fix a few issues in group proto spec 2022-01-12 17:35:38 +05:30
Abin Simon
723c719eb9 Switch to using EntityDAO from common 2022-01-12 17:35:38 +05:30
Abin Simon
82cec87a0a Post rebase fixes 2022-01-12 17:35:38 +05:30
Abin Simon
eba34f40ed Users can now be assigned to roles without group 2022-01-12 17:35:38 +05:30