Effect CommunityEC
Effect Community14mo ago
9 replies
David Novák

Implementing Custom Security with HttpApi in Effect Typescript Library

Hello, I am looking at HttpApi documentation and I would like to implement custom security that creates security from 3 headers (lets say headers user
key
and signature). Is it possible to do with HttpApiSecurity or is the intended way for such an edgecase to create a custom middleware and not bother with HttpApiSecurity at all? I am coming from effect-http library where this was possible to do with:
 
Security.make(
  HttpServerRequest.schemaHeaders(SecurityHeaders).pipe(
    Effect.mapError(() => HttpError.unauthorized('Invalid auth headers'))
  )
).pipe(Security.mapEffect(verifyUserSecurity))
Was this page helpful?