All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ligoj.bootstrap.resource.system.security.CryptoResource Maven / Gradle / Ivy

There is a newer version: 3.1.22
Show newest version
/*
 * Licensed under MIT (https://github.com/ligoj/ligoj/blob/master/LICENSE)
 */
package org.ligoj.bootstrap.resource.system.security;

import jakarta.transaction.Transactional;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

import org.ligoj.bootstrap.core.crypto.CryptoHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Cryptographic management.
 */
@Path("/system/security/crypto")
@Service
@Transactional
public class CryptoResource {

	@Autowired
	private CryptoHelper cryptoHelper;

	/**
	 * Encrypt a value
	 * 
	 * @param value
	 *            The value to encrypt.
	 * @return The encrypted value.
	 */
	@POST
	@Consumes(MediaType.TEXT_PLAIN)
	@Produces(MediaType.TEXT_PLAIN)
	public String create(final String value) {
		return cryptoHelper.encrypt(value);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy