1
- <div style =" text-align :center " ><img src =" https://raw.githubusercontent. com/azutoolkit/authority/main/logo.png " / ></div >
1
+ <div style =" text-align :center " ><img src =" https://github. com/azutoolkit/authority/blob/ main/logo.png " ></div >
2
2
3
- # authority
3
+ # Authority
4
4
5
5
OpenID Connect and OAuth Provider written in Crystal - Security-first, open
6
6
source API security for your infrastructure. SDKs to come.
@@ -13,70 +13,104 @@ Implementing and using OAuth2 without understanding the whole specification is
13
13
challenging and prone to errors, even when SDKs are being used. The primary goal
14
14
of Authority is to make OAuth 2.0 and OpenID Connect 1.0 better accessible.
15
15
16
- ## Installation
16
+ The specification describes five grants for acquiring an access token:
17
17
18
- TODO: Write installation instructions here
18
+ - Authorization code grant
19
+ - Implicit grant
20
+ - Resource owner credentials grant
21
+ - Client credentials grant
22
+ - Refresh token grant
19
23
20
- ## Usage
24
+ ## JSON Web Tokens
21
25
22
- TODO: Write usage instructions here
26
+ At this moment Authority issues JWT OAuth 2.0 Access Tokens as default.
23
27
24
- ## Features Missing
28
+ ## Features
25
29
26
- Token Information Endpoint
30
+ Grant Types
27
31
28
- ``` bash
29
- POST /token_info HTTP/1.1
30
- Host: authorization-server.com
31
- Authorization: Basic Y4NmE4MzFhZGFkNzU2YWRhN
32
+ - [x] Authorization code grant
33
+ - [x] Implicit grant
34
+ - [x] Resource owner credentials grant
35
+ - [x] Client credentials grant
36
+ - [x] Refresh token grant
37
+ - [x] OpenID Connect
38
+ - [x] PKCE
39
+ - [ ] Token Introspection
40
+ - [ ] Token Revocation
32
41
33
- token=c1MGYwNDJiYmYxNDFkZjVkOGI0MSAgLQ
34
- ```
42
+ ## Configuration
35
43
36
- ``` bash
37
- HTTP/1.1 200 OK
38
- Content-Type: application/json; charset=utf-8
39
-
40
- {
41
- " active" : true,
42
- " scope" : " read write email" ,
43
- " client_id" : " J8NFmU4tJVgDxKaJFmXTWvaHO" ,
44
- " username" : " aaronpk" ,
45
- " exp" : 1437275311
46
- }
44
+ Configuration files can be found in ` ./src/config `
45
+
46
+ ### Authly.cr
47
+
48
+ This file contains the configuration for the OAuthly 2 library. Read more about [ Authly shards] ( https://github.com/azutoolkit/authly )
49
+
50
+ ``` crystal
51
+ # Configure
52
+ Authly.configure do |c|
53
+ # Secret Key for JWT Tokens
54
+ c.secret_key = "ExampleSecretKey"
55
+
56
+ # Refresh Token Time To Live
57
+ c.refresh_ttl = 1.hour
58
+
59
+ # Authorization Code Time To Live
60
+ c.code_ttl = 1.hour
61
+
62
+ # Access Token Time To Live
63
+ c.access_ttl = 1.hour
64
+
65
+ # Using your own classes
66
+ c.owners = Authority::OwnerService.new
67
+ c.clients = Authority::ClientService.new
68
+ end
47
69
```
48
70
49
- ID Tokens
71
+ ### Clear.cr
72
+
73
+ This file contains the database configuration. No changes to this files is required.
74
+
75
+ ### Local.env
76
+
77
+ This file contains the environment variables for Authority.
50
78
51
79
``` bash
52
- {
53
- " iss" : " https://server.example.com" ,
54
- " sub" : " 24400320" ,
55
- " aud" : " s6BhdRkqt3" ,
56
- " nonce" : " n-0S6_WzA2Mj" ,
57
- " exp" : 1311281970,
58
- " iat" : 1311280970,
59
- " auth_time" : 1311280969,
60
- " acr" : " urn:mace:incommon:iap:silver"
61
- }
80
+ CRYSTAL_ENV=development
81
+ CRYSTAL_LOG_SOURCES=" *"
82
+ CRYSTAL_LOG_LEVEL=" debug"
83
+ CRYSTAL_WORKERS=4
84
+ PORT=4000
85
+ PORT_REUSE=true
86
+ HOST=0.0.0.0
87
+ DATABASE_URL=postgres://auth_user:auth_pass@db:5432/authority_db
62
88
```
63
89
64
- User Registration
90
+ ## HTML Templates
91
+
92
+ You can change the look of Authority ` signin ` and ` authorize ` html pages.
65
93
66
- Client Registration
94
+ Just edit the ` ./public/templates/signin.html ` and ` ./public/templates/authorize.html `
67
95
68
- ## Development
96
+ ## Installation
97
+
98
+ ### Docker Compose
99
+
100
+ Spin up your server
69
101
70
- TODO: Write development instructions here
102
+ ``` bash
103
+ docker-compose up server
104
+ ```
71
105
72
106
## Contributing
73
107
74
- 1 . Fork it (< https://github.com/your-github-user /authority/fork > )
108
+ 1 . Fork it (https://github.com/azutoolkit /authority/fork )
75
109
2 . Create your feature branch (` git checkout -b my-new-feature ` )
76
110
3 . Commit your changes (` git commit -am 'Add some feature' ` )
77
111
4 . Push to the branch (` git push origin my-new-feature ` )
78
112
5 . Create a new Pull Request
79
113
80
114
## Contributors
81
115
82
- - [ Elias Perez] ( https://github.com/your-github-user ) - creator and maintainer
116
+ - [ Elias Perez] ( https://github.com/eliasjpr ) - creator and maintainer
0 commit comments