Skip to content

Commit f2e4c7e

Browse files
committed
add authz.PolicyConfig to aaasf.Config
1 parent e8fcb43 commit f2e4c7e

File tree

7 files changed

+205
-11
lines changed

7 files changed

+205
-11
lines changed

CONTRIBUTING.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Contributing Guidelines
2+
3+
## Pull Request Checklist
4+
5+
Before sending your pull requests, make sure you followed this list.
6+
7+
1. Open an issue to discuss your PR
8+
2. Ensure you read appropriate Contributor License Agreement (CLA)
9+
3. Run unit tests
10+
11+
## Contributor License Agreements
12+
13+
I'd love to accept your pull request! Before I can take them, we have to jump a
14+
couple of legal hurdles.
15+
16+
***NOTE***: Only original source code from you and other people that have
17+
signed the CLA can be accepted into the main repository.
18+
19+
Please fill out either the individual or corporate Contributor License Agreement (CLA).
20+
* If you are an individual writing original source code and you're sure you own the
21+
intellectual property, then you'll need to sign an [individual CLA](/assets/cla/individual_cla.md).
22+
* If you work for a company that wants to allow you to contribute your work, then
23+
you'll need to sign a [corporate CLA](/assets/cla/corporate_cla.md).
24+
25+
Follow either of the two links above to access the appropriate CLA. Next, if you are
26+
ready to accept, add the following text in the body your first commit message.
27+
28+
* For Individual CLA:
29+
30+
I hereby consent to the Individual CLA provided in assets/cla/individual_cla.md
31+
32+
* For Corporate CLA:
33+
34+
I hereby consent to the Corporate CLA provided in assets/cla/corporate_cla.md
35+
36+

SECURITY.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
To report a vulnerability, please send an email to [email protected].

assets/cla/corporate_cla.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Corporate Contributor License Agreement
2+
3+
In order to clarify the intellectual property license granted with Contributions from any person or entity, Paul Greenberg ("Project Owner") must have a Contributor License Agreement (CLA) on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of Project Owner and its users; it does not change your rights to use your own Contributions for any other purpose.
4+
5+
This version of the Agreement allows an entity (the "Corporation") to submit Contributions to Project Owner, to authorize Contributions submitted by its designated employees to Project Owner, and to grant copyright and patent licenses thereto.
6+
7+
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Project Owner. Except for the license granted herein to Project Owner and recipients of software distributed by Project Owner, You reserve all right, title, and interest in and to Your Contributions.
8+
9+
## Definitions
10+
11+
"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Project Owner. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
12+
13+
"Contribution" shall mean the code, documentation or any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Project Owner for inclusion in, or documentation of, any of the products owned or managed by Project Owner (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Project Owner or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Project Owner for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
14+
15+
## Grant of Copyright License
16+
17+
Subject to the terms and conditions of this Agreement, You hereby grant to Project Owner and to recipients of software distributed by Project Owner a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
18+
19+
## Grant of Patent License
20+
21+
Subject to the terms and conditions of this Agreement, You hereby grant to Project Owner and to recipients of software distributed by Project Owner a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
22+
23+
## Miscellaneous
24+
25+
1. You represent that You are legally entitled to grant the above license. You represent further that each employee of the Corporation designated by You is authorized to submit Contributions on behalf of the Corporation.
26+
27+
2. You represent that each of Your Contributions is Your original creation (see section 4 for submissions on behalf of others).
28+
29+
3. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
30+
31+
4. Should You wish to submit work that is not Your original creation, You may submit it to Project Owner separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
32+
33+
5. It is your responsibility to notify Project Owner when any change is required to the list of designated employees authorized to submit Contributions on behalf of the Corporation, or to the Corporation's Point of Contact with Project Owner.

assets/cla/individual_cla.md

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Individual Contributor License Agreement
2+
3+
In order to clarify the intellectual property license granted with Contributions from
4+
any person or entity, Paul Greenberg ("Project Owner") must have a Contributor License
5+
Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement
6+
to the license terms below. This license is for your protection as a Contributor as well
7+
as the protection of Project Owner; it does not change your rights to use your own
8+
Contributions for any other purpose.
9+
10+
You accept and agree to the following terms and conditions for Your present and future
11+
Contributions submitted to Project Owner. Except for the license granted herein to
12+
Project Owner and recipients of software distributed by Project Owner, You reserve
13+
all right, title, and interest in and to Your Contributions.
14+
15+
## Definitions
16+
17+
"You" (or "Your") shall mean the copyright owner or legal entity authorized by
18+
the copyright owner that is making this Agreement with Project Owner. For legal
19+
entities, the entity making a Contribution and all other entities that control, are
20+
controlled by, or are under common control with that entity are considered to be a single
21+
Contributor. For the purposes of this definition, "control" means (i) the power, direct
22+
or indirect, to cause the direction or management of such entity, whether by contract
23+
or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding
24+
shares, or (iii) beneficial ownership of such entity.
25+
26+
"Contribution" shall mean any original work of authorship, including any modifications
27+
or additions to an existing work, that is intentionally submitted by You to Project
28+
Owner for inclusion in, or documentation of, any of the products owned or managed by
29+
Project Owner (the "Work"). For the purposes of this definition, "submitted" means any
30+
form of electronic, verbal, or written communication sent to Project Owner or its
31+
representatives, including but not limited to communication on electronic mailing lists,
32+
source code control systems, and issue tracking systems that are managed by, or on
33+
behalf of, Project Owner for the purpose of discussing and improving the Work, but
34+
excluding communication that is conspicuously marked or otherwise designated in writing
35+
by You as "Not a Contribution."
36+
37+
## Grant of Copyright License
38+
39+
Subject to the terms and conditions of this Agreement, You hereby grant to Project
40+
Owner and to recipients of software distributed by Project Owner a perpetual,
41+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license
42+
to reproduce, prepare derivative works of, publicly display, publicly perform,
43+
sublicense, and distribute Your Contributions and such derivative works.
44+
45+
## Grant of Patent License
46+
47+
Subject to the terms and conditions of this Agreement, You hereby grant to Project
48+
Owner and to recipients of software distributed by Project Owner a perpetual,
49+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
50+
this section) patent license to make, have made, use, offer to sell, sell, import,
51+
and otherwise transfer the Work, where such license applies only to those patent
52+
claims licensable by You that are necessarily infringed by Your Contribution(s)
53+
alone or by combination of Your Contribution(s) with the Work to which such
54+
Contribution(s) was submitted. If any entity institutes patent litigation against
55+
You or any other entity (including a cross-claim or counterclaim in a lawsuit)
56+
alleging that your Contribution, or the Work to which you have contributed,
57+
constitutes direct or contributory patent infringement, then any patent licenses
58+
granted to that entity under this Agreement for that Contribution or Work shall
59+
terminate as of the date such litigation is filed.
60+
61+
## Miscellaneous
62+
63+
1. You represent that you are legally entitled to grant the above license. If your
64+
employer(s) has rights to intellectual property that you create that includes
65+
your Contributions, you represent that you have received permission to make
66+
Contributions on behalf of that employer, that your employer has waived such
67+
rights for your Contributions to Project Owner, or that your employer has
68+
executed a separate Corporate CLA with Project Owner.
69+
70+
2. You represent that each of Your Contributions is Your original creation
71+
(see section 4 for submissions on behalf of others). You represent that Your
72+
Contribution submissions include complete details of any third-party license
73+
or other restriction (including, but not limited to, related patents and trademarks)
74+
of which you are personally aware and which are associated with any part of Your
75+
Contributions.
76+
77+
3. You are not expected to provide support for Your Contributions, except to
78+
the extent You desire to provide support. You may provide support for free,
79+
for a fee, or not at all. Unless required by applicable law or agreed to in
80+
writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES
81+
OR CONDITIONS OF ANY KIND, either express or implied, including, without
82+
limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT,
83+
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
84+
85+
4. Should You wish to submit work that is not Your original creation, You may
86+
submit it to Project Owner separately from any Contribution, identifying the
87+
complete details of its source and of any license or other restriction (including,
88+
but not limited to, related patents, trademarks, and license agreements) of
89+
which you are personally aware, and conspicuously marking the work as
90+
"Submitted on behalf of a third-party: [named here]".
91+
92+
5. You agree to notify Project Owner of any facts or circumstances of
93+
which you become aware that would make these representations inaccurate
94+
in any respect.

config.go

+4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package aaasf
22

33
import (
4+
"github.com/greenpau/aaasf/pkg/authn"
5+
"github.com/greenpau/aaasf/pkg/authz"
46
"github.com/greenpau/aaasf/pkg/credentials"
57
)
68

79
// Config is a configuration of Server.
810
type Config struct {
911
Credentials []*credentials.Config `json:"credentials,omitempty" xml:"credentials,omitempty" yaml:"credentials,omitempty"`
12+
Portals []*authn.PortalConfig `json:"auth_portal_config,omitempty" xml:"auth_portal_config,omitempty" yaml:"auth_portal_config,omitempty"`
13+
Policies []*authz.PolicyConfig `json:"authz_policy_config,omitempty" xml:"authz_policy_config,omitempty" yaml:"authz_policy_config,omitempty"`
1014
credMap map[string]*credentials.Config
1115
}
1216

internal/tag/tag_test.go

+22-11
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,30 @@ import (
2222
"github.com/greenpau/aaasf/internal/testutils"
2323
"github.com/greenpau/aaasf/pkg/acl"
2424
"github.com/greenpau/aaasf/pkg/authn"
25-
"github.com/greenpau/aaasf/pkg/authn/registration"
26-
"github.com/greenpau/aaasf/pkg/credentials"
27-
"github.com/greenpau/aaasf/pkg/identity"
28-
"github.com/greenpau/aaasf/pkg/identity/qr"
29-
"github.com/greenpau/aaasf/pkg/kms"
30-
"github.com/greenpau/aaasf/pkg/requests"
31-
"github.com/greenpau/aaasf/pkg/util/cfg"
32-
"strings"
33-
"unicode"
34-
// "github.com/greenpau/aaasf/pkg/shared"
3525
"github.com/greenpau/aaasf/pkg/authn/backends"
3626
"github.com/greenpau/aaasf/pkg/authn/backends/ldap"
3727
"github.com/greenpau/aaasf/pkg/authn/backends/local"
3828
"github.com/greenpau/aaasf/pkg/authn/backends/oauth2"
3929
"github.com/greenpau/aaasf/pkg/authn/backends/saml"
4030
authncache "github.com/greenpau/aaasf/pkg/authn/cache"
4131
"github.com/greenpau/aaasf/pkg/authn/cookie"
32+
"github.com/greenpau/aaasf/pkg/authn/registration"
4233
"github.com/greenpau/aaasf/pkg/authn/transformer"
4334
"github.com/greenpau/aaasf/pkg/authn/ui"
35+
"github.com/greenpau/aaasf/pkg/authz"
4436
"github.com/greenpau/aaasf/pkg/authz/cache"
4537
"github.com/greenpau/aaasf/pkg/authz/options"
4638
"github.com/greenpau/aaasf/pkg/authz/validator"
39+
"github.com/greenpau/aaasf/pkg/credentials"
40+
"github.com/greenpau/aaasf/pkg/identity"
41+
"github.com/greenpau/aaasf/pkg/identity/qr"
42+
"github.com/greenpau/aaasf/pkg/kms"
43+
"github.com/greenpau/aaasf/pkg/requests"
4744
"github.com/greenpau/aaasf/pkg/shared/idp"
4845
"github.com/greenpau/aaasf/pkg/user"
46+
"github.com/greenpau/aaasf/pkg/util/cfg"
47+
"strings"
48+
"unicode"
4949

5050
"os"
5151
"path/filepath"
@@ -529,7 +529,13 @@ func TestTagCompliance(t *testing.T) {
529529
{
530530
name: "test aaasf.Config struct",
531531
entry: &aaasf.Config{},
532-
opts: &Options{},
532+
opts: &Options{
533+
AllowFieldMismatch: true,
534+
AllowedFields: map[string]interface{}{
535+
"auth_portal_config": true,
536+
"authz_policy_config": true,
537+
},
538+
},
533539
},
534540
{
535541
name: "test cache.TokenCache struct",
@@ -638,6 +644,11 @@ func TestTagCompliance(t *testing.T) {
638644
entry: &acl.AccessList{},
639645
opts: &Options{},
640646
},
647+
{
648+
name: "test authz.PolicyConfig struct",
649+
entry: &authz.PolicyConfig{},
650+
opts: &Options{},
651+
},
641652
}
642653

643654
for _, tc := range testcases {

pkg/authz/config.go

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package authz
2+
3+
import (
4+
// "time"
5+
// "go.uber.org/zap"
6+
)
7+
8+
// PolicyConfig TODO
9+
type PolicyConfig struct {
10+
Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"`
11+
}

0 commit comments

Comments
 (0)