7 ## do we have a usable session?
8 sub session_id_present {
9 if (defined $context and
10 exists $context->{session_id} and
11 length $context->{session_id})
18 my $current_url = $ENV{REQUEST_URI};
20 ## let's calculate the path of our mason autohandler root
21 my $path = $m->request_comp()->dir_path();
22 $path = substr ($path, 1);
23 $path =~ s/[^\/]+/../g;
24 $path .= "/" if (length $path);
26 ### let's check if i18n is configured correctly
27 my $i18n_path = $ENV{OPENXPKI_LOCALE_PREFIX};
28 if ((not $i18n_path) or (not -e $i18n_path)) {
30 <?xml version="1.0" encoding="utf-8"?>
31 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
32 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
34 <title>OpenXPKI configuration error</title>
35 <link rel="stylesheet"
36 href="<& /lib/url.mhtml,
37 path => "${path}css/sinorcaish-screen.css",
39 type="text/css" media="screen" />
40 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
43 <h1>Variable OPENXPKI_LOCALE_PREFIX is not set or contains non-existent path!</h1>
44 <p>Please set variable OPENXPKI_LOCALE_PREFIX in your Apache configuration file.</p>
51 if ($m->base_comp()->title() ne '/index.html') {
52 if (! defined $next_comp) {
53 $next_comp = $m->base_comp()->title();
54 if (scalar keys %{ $m ->request_args() } > 0) {
56 foreach my $key (keys %{ $m->request_args() }) {
57 $next_comp .= $key . '=' . $m->request_args()->{$key} . '&';
62 ## if the session is present or faked and
63 ## the user tries to penetrate the server then
64 ## nothing will happen because the server simply
65 ## asks for login and terminates the session
66 ## if the authentication is not ok
67 ## IMPORTANT: the server and not the client enforces the security
68 ## EXCEPTION: if shibboleth is in use then the client forwards
69 ## the session id from its environment (a session injection
70 ## from the browser is not possible)
72 if (not session_id_present())
74 $auth_stuff = $m->scomp('/authentication/autohandler', '__session_id' => $__session_id, next_comp => $next_comp);
75 if ($auth_stuff =~ /CONNECTION_WORKING/) {
78 elsif ($auth_stuff =~ /REDIRECT_TO_SERVICE_AUTOHANDLER/)
80 ## the authentication was successfully finished and
81 ## now we redirect to the service area
83 <?xml version="1.0" encoding="utf-8"?>
84 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
85 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
87 % ## if there is an explicit target specified by next_comp
88 % ## then we try to call it (security especially permission
89 % ## enforcement is managed by the daemon not by the web client)
91 % # if next_comp already contains session_id and role then remove these items
92 % # to prevent mixture with newly received session_id and role
93 % my ($old_session_id) = ($next_comp =~ m{\A .* __session_id=(.+?) & .* \z }xms);
94 % my ($old_role) = ($next_comp =~ m{\A .* __role=(.*?) & .* \z }xms);
95 % $next_comp =~ s{__session_id=$old_session_id&}{}ms;
96 % $next_comp =~ s{__role=$old_role&}{}ms;
97 % ## an example URL can be (/openxpki is the mason root directory):
98 % ## http://localhost/openxpki/index.html?next_comp=service/api/issuer_list.html
99 % ## after the authentication is gone then the redirect shows the issuer list
100 % $path =~ s{ / \z}{}xms;
101 % if ($next_comp !~ /\&/) {
104 <meta http-equiv="refresh" content="0; URL=<% $path %><% $next_comp | n %>__session_id=<% $context->{session_id} %>&__role=<% $context->{role} %>&no_menu=<% $no_menu %>&__language=<% $context->{language} %>"/>
106 <meta http-equiv="refresh" content="0; URL=<% $path %>service/index.html?__session_id=<% $context->{session_id} %>&__role=<% $context->{role} %>&__language=<% $context->{language} %>"/>
115 ## sometimes no_menu is active but we need some informations
116 ## from the menu class to calculate links
117 ## therefore we initialize the menu separately from the output
118 $m->comp ('/lib/init_menu.mhtml') if (not $auth_stuff);
120 % if ($m->request_comp()->title() !~ /^\/binary\//) {
121 <?xml version="1.0" encoding="utf-8"?>
122 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
123 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
125 <title><& SELF:title, %ARGS &></title>
126 <link rel="stylesheet"
127 href="<& /lib/url.mhtml,
128 path => "${path}css/sinorcaish-screen.css",
130 type="text/css" media="screen" />
131 <link rel="stylesheet"
132 href="<& /lib/url.mhtml,
133 path => "${path}css/sinorcaish-print.css",
135 type="text/css" media="print" />
136 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
137 <meta http-equiv="Content-Script-Type" content="text/javascript"/>
140 <!-- For non-visual or non-stylesheet-capable user agents -->
141 <div id="mainlink"><a href="#main">Skip to main content.</a></div>
144 <div class="left" style="height: 68px">
145 <a href="http://www.openxpki.org/"><img
146 src="<% ${path} %>images/openxpki_sinorcaish.png" alt="OpenXPKI"
147 width="325" height="68" /></a>
151 % # if (! $m->request_args()->{'no_menu'} &&
153 % $m->request_comp()->title() !~ m{\A /authentication/index.html \z}xms) {
154 % # show search button only if menu is activated
155 % # and we are not at the login page
156 <span class="hidden">Useful links:</span>
158 <a href="index.html">Contacts</a> |
160 <a href="http://www.openxpki.org/resources/index.html">Feedback</a> |
164 <a href="http://www.openxpki.org">About</a>
166 % if ($__session_id) {
167 % my $session = CGI::Session->new(
171 % Directory => $ENV{OPENXPKI_MASON_SESSION_DIR},
174 % $m->comp ('/lib/debug.mhtml',
176 % 'msg' => "CGI::Session with session ID $__session_id retrieved");
177 % if (defined $session && defined $session->param('user')) {
178 % $m->comp ('/lib/debug.mhtml',
180 % 'msg' => "CGI::Session object id: " . $session->id());
181 % my $role = $session->param('role') ? $session->param('role') : 'Anonymous';
182 <div><% $session->param('user') . ' | ' . $role %> |
185 % $root = $context->{menu}->get_root();
187 % if (defined $root) {
188 <a href="<% $root . '/' %>"><% i18nGettext($session->param('pki_realm')) %></a>
191 <% i18nGettext($session->param('pki_realm')) %>
196 % if (exists $context->{menu}) {
198 <form action="<% $context->{menu}->get_root() %>/service/api/super_search.html" method="post">
199 <script type="text/javascript">
200 var EmptySearchFieldDone = 0;
201 function EmptySearchField(elem) {
202 if (EmptySearchFieldDone == 0) {
204 EmptySearchFieldDone = 1;
211 % foreach my $lang qw( en ru de ) {
212 % $urls->{$lang} = $current_url;
214 % $urls->{'en'} =~ s/__language=[^;]*/__language=en_US/;
215 % $urls->{'ru'} =~ s/__language=[^;]*/__language=ru_RU/;
216 % $urls->{'de'} =~ s/__language=[^;]*/__language=de_DE/;
217 % my @configured_languages = $m->comp('/lib/configured_languages.mhtml');
218 % if (scalar @configured_languages > 1) {
219 % # only show flags if there is a choice ...
220 % foreach my $lang (@configured_languages) {
221 <a href="<% $urls->{$lang} %>"><img src="<% $context->{menu}->get_root() %>/images/<% $lang %>.png" style="margin-right:-1em"></a>
224 <input type="text" name="q" value="Search" onfocus="EmptySearchField(this)" size="15" maxlength="250" />
225 % my %menu_hash = $context->{menu}->get_menu_hash();
226 % foreach my $key (keys %menu_hash) {
227 % my $menu_content = $menu_hash{$key} || '';
228 <input type="hidden" name="<% $key %>" value="<% $menu_content %>"/>
230 <input type="image" name="submit" src="<% ${path} %>images/search.png" alt="Search" />
236 </div> <!-- end of right -->
238 % if (not $auth_stuff and not $no_menu) {
239 <& /lib/get_menu.mhtml,
243 <div class="subheader"> </div>
246 </div> <!-- end of header -->
249 <div> <!-- this div controls the distance between the list and the window -->
250 % if (not $auth_stuff and not $no_menu) {
251 <& /lib/get_menu.mhtml,
257 </div> <!-- end of sidebar -->
260 % } ## end of if not binary
263 if (not length $auth_stuff)
271 % if ($m->request_comp()->title() !~ /^\/binary\//) {
274 <div id="footer"><small>© 2006-2009 <a href="http://www.openxpki.org">The OpenXPKI Project</a></small>
284 inherit => '/syshandler'