1# OpenXPKI::Server::Workflow::Activity::NICE::IssueCRL 2# Written by Oliver Welter for the OpenXPKI Project 2011 3# Copyright (c) 2011 by The OpenXPKI Project 4 5package OpenXPKI::Server::Workflow::Activity::NICE::IssueCRL; 6 7use strict; 8use base qw( OpenXPKI::Server::Workflow::Activity ); 9 10use OpenXPKI::Server::Context qw( CTX ); 11use OpenXPKI::Exception; 12use OpenXPKI::Debug; 13use OpenXPKI::Serialization::Simple; 14 15use OpenXPKI::Server::NICE::Factory; 16 17use Data::Dumper; 18 19sub execute { 20 my $self = shift; 21 my $workflow = shift; 22 my $context = $workflow->context(); 23 24 ##! 64: 'context: ' . Dumper( $context ) 25 26 my $nice_backend = OpenXPKI::Server::NICE::Factory->getHandler( $self ); 27 28 my $ca_alias = $context->param( 'ca_alias' ); 29 30 if (!$ca_alias) { 31 OpenXPKI::Exception->throw ( 32 message => "I18N_OPENXPKI_SERVER_NICE_CRLISSUANCE_NO_CA_ID", 33 ); 34 } 35 ##! 16: 'CRL for alias ' . $ca_alias 36 37 CTX('log')->application()->info("start crl issue for ca $ca_alias, workflow " . $workflow->id); 38 39 my $param = $self->param(); 40 delete $param->{'ca_alias'}; 41 ##! 32: 'Extra params ' . Dumper $param 42 43 my $set_context = $nice_backend->issueCRL( $ca_alias, $param ); 44 45 if(!$set_context) { 46 47 my $error = $nice_backend->get_last_error() || 'I18N_OPENXPKI_UI_NICE_BACKEND_ERROR'; 48 49 # Catch exception as "pause" if configured 50 if ($self->param('pause_on_error')) { 51 CTX('log')->application()->warn("NICE IssueCRL failed but pause_on_error is requested "); 52 CTX('log')->application()->debug("Original error: " . $error); 53 $self->pause('I18N_OPENXPKI_UI_PAUSED_CERTSIGN_TOKEN_SIGNING_FAILED'); 54 } 55 56 if (my $exc = OpenXPKI::Exception->caught()) { 57 $exc->rethrow(); 58 } else { 59 OpenXPKI::Exception->throw( message => $error ); 60 } 61 } 62 63 64 ##! 64: 'Setting Context ' . Dumper $set_context 65 #while (my ($key, $value) = each(%$set_context)) { 66 foreach my $key (keys %{$set_context} ) { 67 my $value = $set_context->{$key}; 68 $context->param( { $key => $value } ); 69 } 70 71} 72 731; 74__END__ 75 76=head1 Name 77 78OpenXPKI::Server::Workflow::Activity::NICE::IssueCRL; 79 80=head1 Description 81 82Initate CRL issuance using the configured NICE backend. 83 84See OpenXPKI::Server::NICE::issueCRL for details 85 86=head1 Parameters 87 88=head2 Input 89 90All parameters except ca_alias, are mapped to the backend as is. Please 91check the documentation of the used backend for available parameters. 92 93=over 94 95=item ca_alias (optional) 96 97the ca alias to genrate the CRL for, if not given the context value for 98I<ca_alias> is used. 99 100=back 101 102=head2 Output 103 104=over 105 106=item crl_serial - the serial number of the issued crl or I<pending> 107 108=back 109