| 642 | } |
| 643 | |
| 644 | Dictionary::Ptr ApiActions::GenerateTicket(const ConfigObject::Ptr&, const ApiUser::Ptr&, const Dictionary::Ptr& params) |
| 645 | { |
| 646 | if (!params->Contains("cn")) |
| 647 | return ApiActions::CreateResult(400, "Option 'cn' is required"); |
| 648 | |
| 649 | String cn = HttpUtility::GetLastParameter(params, "cn"); |
| 650 | |
| 651 | ApiListener::Ptr listener = ApiListener::GetInstance(); |
| 652 | String salt = listener->GetTicketSalt(); |
| 653 | |
| 654 | if (salt.IsEmpty()) |
| 655 | return ApiActions::CreateResult(500, "Ticket salt is not configured in ApiListener object"); |
| 656 | |
| 657 | String ticket = PBKDF2_SHA1(cn, salt, 50000); |
| 658 | |
| 659 | Dictionary::Ptr additional = new Dictionary({ |
| 660 | { "ticket", ticket } |
| 661 | }); |
| 662 | |
| 663 | return ApiActions::CreateResult(200, "Generated PKI ticket '" + ticket + "' for common name '" |
| 664 | + cn + "'.", additional); |
| 665 | } |
| 666 | |
| 667 | Value ApiActions::GetSingleObjectByNameUsingPermissions(const String& type, const String& objectName, const ApiUser::Ptr& user) |
| 668 | { |
nothing calls this directly
no test coverage detected