| 1 | # | ||
| 2 | # This file is part of WebDyne. | ||
| 3 | # | ||
| 4 | # This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>. | ||
| 5 | # | ||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||
| 8 | # | ||
| 9 | # Full license text is available at: | ||
| 10 | # | ||
| 11 | # <http://dev.perl.org/licenses/> | ||
| 12 | # | ||
| 13 | |||
| 14 | |||
| 15 | # Constants file | ||
| 16 | # | ||
| 17 | package WebDyne::Session::Constant; | ||
| 18 | |||
| 19 | |||
| 20 | # Pragma | ||
| 21 | # | ||
| 22 | use strict qw(vars); | ||
| 23 | use vars qw($VERSION @ISA %Constant); | ||
| 24 | use warnings; | ||
| 25 | |||
| 26 | |||
| 27 | # Does the heavy liftying of importing into caller namespace | ||
| 28 | # | ||
| 29 | require WebDyne::Constant; | ||
| 30 | @ISA=qw(WebDyne::Constant); | ||
| 31 | |||
| 32 | |||
| 33 | # Version information. Must be all on one line | ||
| 34 | # | ||
| 35 | $VERSION='3.029'; | ||
| 36 | |||
| 37 | |||
| 38 | # The guts | ||
| 39 | # | ||
| 40 | %Constant=( | ||
| 41 | |||
| 42 | # This is the name of the cookie the browser will receive to keep session id | ||
| 43 | # | ||
| 44 | WEBDYNE_SESSION_ID_COOKIE_NAME => 'session', | ||
| 45 | |||
| 46 | |||
| 47 | # Session cookie attributes | ||
| 48 | # | ||
| 49 | WEBDYNE_SESSION_COOKIE_PATH => '/', | ||
| 50 | WEBDYNE_SESSION_COOKIE_SECURE => 1, | ||
| 51 | WEBDYNE_SESSION_COOKIE_HTTPONLY => 1, | ||
| 52 | WEBDYNE_SESSION_COOKIE_SAMESITE => 'Lax', | ||
| 53 | |||
| 54 | |||
| 55 | ); | ||
| 56 | |||
| 57 | |||
| 58 | # Done | ||
| 59 | # | ||
| 60 | 1;__END__ | ||
| 61 | |||
| 62 | =begin markdown | ||
| 63 | |||
| 64 | # WebDyne::Session::Constant # | ||
| 65 | |||
| 66 | # NAME # | ||
| 67 | |||
| 68 | WebDyne::Session::Constant - session-cookie constants for WebDyne | ||
| 69 | |||
| 70 | # SYNOPSIS # | ||
| 71 | |||
| 72 | ```perl | ||
| 73 | use WebDyne::Session::Constant; | ||
| 74 | ``` | ||
| 75 | |||
| 76 | # DESCRIPTION # | ||
| 77 | |||
| 78 | `WebDyne::Session::Constant` defines the session-layer constant used by `WebDyne::Session` when creating or reading the browser cookie that carries the session identifier. | ||
| 79 | |||
| 80 | # CONSTANTS # | ||
| 81 | |||
| 82 | * **WEBDYNE_SESSION_ID_COOKIE_NAME ('session')** | ||
| 83 | |||
| 84 | Name of the cookie used to store the WebDyne session identifier on the client. | ||
| 85 | |||
| 86 | * **WEBDYNE_SESSION_COOKIE_PATH ('/')** | ||
| 87 | |||
| 88 | Path attribute used when setting the WebDyne session cookie. | ||
| 89 | |||
| 90 | * **WEBDYNE_SESSION_COOKIE_SECURE (1)** | ||
| 91 | |||
| 92 | Add the `Secure` attribute to newly generated session cookies. Set to `0` for plain HTTP development deployments. | ||
| 93 | |||
| 94 | * **WEBDYNE_SESSION_COOKIE_HTTPONLY (1)** | ||
| 95 | |||
| 96 | Add the `HttpOnly` attribute to newly generated session cookies. | ||
| 97 | |||
| 98 | * **WEBDYNE_SESSION_COOKIE_SAMESITE ('Lax')** | ||
| 99 | |||
| 100 | SameSite attribute used for newly generated session cookies. Set to an empty value to omit the attribute. | ||
| 101 | |||
| 102 | # AUTHOR # | ||
| 103 | |||
| 104 | Andrew Speer <andrew.speer@isolutions.com.au> | ||
| 105 | |||
| 106 | # LICENSE and COPYRIGHT | ||
| 107 | |||
| 108 | This file is part of WebDyne. | ||
| 109 | |||
| 110 | This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>. | ||
| 111 | |||
| 112 | This is free software; you can redistribute it and/or modify it under | ||
| 113 | the same terms as the Perl 5 programming language system itself. | ||
| 114 | |||
| 115 | Full license text is available at: | ||
| 116 | |||
| 117 | <http://dev.perl.org/licenses/> | ||
| 118 | |||
| 119 | |||
| 120 | =end markdown | ||
| 121 | |||
| 122 | |||
| 123 | =head1 WebDyne::Session::Constant | ||
| 124 | |||
| 125 | |||
| 126 | =head1 NAME | ||
| 127 | |||
| 128 | WebDyne::Session::Constant - session-cookie constants for WebDyne | ||
| 129 | |||
| 130 | |||
| 131 | =head1 SYNOPSIS | ||
| 132 | |||
| 133 | |||
| 134 | use WebDyne::Session::Constant; | ||
| 135 | |||
| 136 | =head1 DESCRIPTION | ||
| 137 | |||
| 138 | C<WebDyne::Session::Constant> defines the session-layer constant used by C<WebDyne::Session> when creating or reading the browser cookie that carries the session identifier. | ||
| 139 | |||
| 140 | |||
| 141 | =head1 CONSTANTS | ||
| 142 | |||
| 143 | =over | ||
| 144 | |||
| 145 | =item * | ||
| 146 | |||
| 147 | B<WEBDYNE_SESSION_ID_COOKIE_NAME ('session')> | ||
| 148 | |||
| 149 | Name of the cookie used to store the WebDyne session identifier on the client. | ||
| 150 | |||
| 151 | |||
| 152 | |||
| 153 | =item * | ||
| 154 | |||
| 155 | B<WEBDYNE_SESSION_COOKIE_PATH ('/')> | ||
| 156 | |||
| 157 | Path attribute used when setting the WebDyne session cookie. | ||
| 158 | |||
| 159 | |||
| 160 | |||
| 161 | =item * | ||
| 162 | |||
| 163 | B<WEBDYNE_SESSION_COOKIE_SECURE (1)> | ||
| 164 | |||
| 165 | Add the C<Secure> attribute to newly generated session cookies. Set to C<0> for plain HTTP development deployments. | ||
| 166 | |||
| 167 | |||
| 168 | |||
| 169 | =item * | ||
| 170 | |||
| 171 | B<WEBDYNE_SESSION_COOKIE_HTTPONLY (1)> | ||
| 172 | |||
| 173 | Add the C<HttpOnly> attribute to newly generated session cookies. | ||
| 174 | |||
| 175 | |||
| 176 | |||
| 177 | =item * | ||
| 178 | |||
| 179 | B<WEBDYNE_SESSION_COOKIE_SAMESITE ('Lax')> | ||
| 180 | |||
| 181 | SameSite attribute used for newly generated session cookies. Set to an empty value to omit the attribute. | ||
| 182 | |||
| 183 | |||
| 184 | |||
| 185 | =back | ||
| 186 | |||
| 187 | |||
| 188 | =head1 AUTHOR | ||
| 189 | |||
| 190 | Andrew Speer L<mailto:andrew.speer@isolutions.com.au> | ||
| 191 | |||
| 192 | |||
| 193 | =head1 LICENSE and COPYRIGHT | ||
| 194 | |||
| 195 | This file is part of WebDyne. | ||
| 196 | |||
| 197 | This software is copyright (c) 2026 by Andrew Speer L<mailto:andrew.speer@isolutions.com.au>. | ||
| 198 | |||
| 199 | This is free software; you can redistribute it and/or modify it under | ||
| 200 | the same terms as the Perl 5 programming language system itself. | ||
| 201 | |||
| 202 | Full license text is available at: | ||
| 203 | |||
| 204 | L<http://dev.perl.org/licenses/> | ||
| 205 | |||
| 206 | =cut |