Skip to content

Instantly share code, notes, and snippets.

@CremboC

CremboC/file.kt Secret

Created August 19, 2016 15:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
@Service
@Profile("scanner")
open class EncryptedRestService
@Autowired constructor(val cryptoService: CryptoService) {
fun <T, R : Any> post(url: String, params: T): Request<T, R> {
return Request(url, HttpMethod.POST, params)
}
inner class Request<T, R : Any>(val url: String, val method: HttpMethod, val params: T? = null) {
fun withCredentials(username: String, password: String): EncryptedRequest<T, R> {
val headers = HttpHeaders()
val key = byteArrayOf()
return EncryptedRequest(this, headers, key)
}
}
inner class EncryptedRequest<T, R : Any>(req: Request<T, R>,
val headers: HttpHeaders,
val key: ByteArray) {
fun expect(clazz: KClass<R>): R? {
return null
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment