use of io.swagger.v3.oas.models.Operation in project cas by apereo.
the class CasResolveAttributesReportEndpoint method resolvePrincipalAttributes.
/**
* Resolve principal attributes map.
*
* @param uid the uid
* @return the map
*/
@ReadOperation
@Operation(summary = "Resolve principal attributes for user", parameters = { @Parameter(name = "uid", required = true) })
public Map<String, Object> resolvePrincipalAttributes(@Selector final String uid) {
val p = defaultPrincipalResolver.getObject().resolve(new BasicIdentifiableCredential(uid));
val map = new HashMap<String, Object>();
map.put("uid", p.getId());
map.put("attributes", p.getAttributes());
return map;
}
use of io.swagger.v3.oas.models.Operation in project cas by apereo.
the class U2FRegisteredDevicesEndpoint method delete.
/**
* Delete.
*
* @param username the username
*/
@DeleteOperation
@Operation(summary = "Delete all registered devices", parameters = { @Parameter(name = "username", required = true) })
public void delete(@Selector final String username) {
val registeredDevices = new ArrayList<>(u2fDeviceRepository.getObject().getRegisteredDevices(username));
registeredDevices.forEach(u2fDeviceRepository.getObject()::deleteRegisteredDevice);
}
use of io.swagger.v3.oas.models.Operation in project cas by apereo.
the class SSOSamlIdPPostProfileHandlerEndpoint method produceGet.
/**
* Produce response entity.
*
* @param request the request
* @param response the response
* @return the response entity
*/
@GetMapping(produces = MediaType.APPLICATION_XML_VALUE)
@ResponseBody
@Operation(summary = "Produce SAML2 response entity", parameters = { @Parameter(name = "username", required = true), @Parameter(name = "password", required = true), @Parameter(name = SamlProtocolConstants.PARAMETER_ENTITY_ID, required = true), @Parameter(name = "encrypt") })
public ResponseEntity<Object> produceGet(final HttpServletRequest request, final HttpServletResponse response) {
val username = request.getParameter("username");
val password = request.getParameter("password");
val entityId = request.getParameter(SamlProtocolConstants.PARAMETER_ENTITY_ID);
val encrypt = Boolean.parseBoolean(request.getParameter("encrypt"));
return produce(request, response, username, password, entityId, encrypt);
}
use of io.swagger.v3.oas.models.Operation in project cas by apereo.
the class YubiKeyAccountRegistryEndpoint method export.
/**
* Export.
*
* @return the response entity
*/
@GetMapping(path = "/export", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
@ResponseBody
@Operation(summary = "Export all Yubikey accounts as a zip file")
public ResponseEntity<Resource> export() {
val accounts = registry.getObject().getAccounts();
val resource = CompressionUtils.toZipFile(accounts.stream(), Unchecked.function(entry -> {
val acct = (YubiKeyAccount) entry;
val fileName = String.format("%s-%s", acct.getUsername(), acct.getId());
val sourceFile = File.createTempFile(fileName, ".json");
MAPPER.writeValue(sourceFile, acct);
return sourceFile;
}), "yubikeybaccts");
val headers = new HttpHeaders();
headers.setContentDisposition(ContentDisposition.attachment().filename(Objects.requireNonNull(resource.getFilename())).build());
return new ResponseEntity<>(resource, headers, HttpStatus.OK);
}
use of io.swagger.v3.oas.models.Operation in project cas by apereo.
the class YubiKeyAccountRegistryEndpoint method importAccount.
/**
* Import account.
*
* @param request the request
* @return the http status
* @throws Exception the exception
*/
@Operation(summary = "Import a Yubikey account as a JSON document")
@PostMapping(path = "/import", consumes = MediaType.APPLICATION_JSON_VALUE)
public HttpStatus importAccount(final HttpServletRequest request) throws Exception {
val requestBody = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8);
LOGGER.trace("Submitted account: [{}]", requestBody);
val account = MAPPER.readValue(requestBody, new TypeReference<YubiKeyAccount>() {
});
LOGGER.trace("Storing account: [{}]", account);
registry.getObject().save(account);
return HttpStatus.CREATED;
}
Aggregations