Coverage for gws-app/gws/plugin/auth_method/__init__.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-05 13:35 +0200

1"""Authentication methods. 

2 

3An authentication method defines how credentials and sessions are passed 

4between the client and the server. Methods are configured in ``auth.methods``. 

5The credentials a method extracts from a request are checked by the 

6authentication providers (``auth.providers``). 

7 

8Subpackages 

9----------- 

10 

11- ``basic`` - HTTP Basic authentication. The credentials are sent with every 

12 request in the ``Authorization`` header, and each request gets a transient 

13 session. 

14- ``token`` - a token in a configurable HTTP header. Each request gets a 

15 transient session. 

16- ``web`` - a login form and a session cookie. Includes the ``auth`` action, 

17 the client API for login, logout and multi-factor authentication, and an 

18 optional redirect of denied page requests to a login page. 

19 

20Example:: 

21 

22 auth.methods+ { 

23 type "web" 

24 loginRedirect { 

25 pattern "^/project" 

26 target "/login" 

27 } 

28 } 

29 

30 auth.methods+ { type "basic" } 

31 

32 auth.providers+ { type "file" path "/data/users.json" } 

33 

34 actions+ { 

35 type "auth" 

36 permissions.read "allow all" 

37 } 

38"""