Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Policy = Policy {}
- newtype Resource = Resource Text
- newtype PemFilePath = PemFilePath Text
- newtype KeyPairId = KeyPairId Text
- type CookiesText = [(Text, Text)]
- data SetCookie :: *
- newtype CookieDomain = CookieDomain Text
- newtype CookiePath = CookiePath Text
- data NominalDiffTime :: *
- type POSIXTime = NominalDiffTime
- newtype Lifespan = Lifespan NominalDiffTime
- data StartTime
- newtype EndTime = EndTime POSIXTime
- data IpAddress
- data Text :: *
- data ByteString :: *
- data PrivateKey :: *
Policy
A policy specifies what resource is being granted, for what time period, and to what IP addresses.
For AWS's documentation on what going into a CloudFront policy statement, see Values That You Specify in the Policy Statement for a Custom Policy for Signed Cookies.
Policy | |
|
URL that a policy will grant access to, optionally containing asterisks for wildcards.
Examples:
"https:/
/d123example.cloudfront.net/index.html"
"https:/
/d123example.cloudfront.net/*.jpeg"
Crypto
newtype PemFilePath Source #
Location in the filesystem where a .pem file containing an RSA secret key can be found.
The filename downloaded from AWS looks like this:
"pk-APKAIATX
N3RCIOVT5WRQ.pem"
CloudFront key pair ID for the key pair that you are using to generate signature.
The key pair ID can be found in the name of key files that you download, and looks like this:
APKAIATXN3
RCIOVT5WRQ
Cookies
type CookiesText = [(Text, Text)] #
Textual cookies. Functions assume UTF8 encoding.
Data type representing the key-value pair to use for a cookie, as well as configuration options for it.
Creating a SetCookie
SetCookie
does not export a constructor; instead, use defaultSetCookie
and override values (see http://www.yesodweb.com/book/settings-types for details):
import Web.Cookie :set -XOverloadedStrings let cookie =defaultSetCookie
{setCookieName
= "cookieName",setCookieValue
= "cookieValue" }
Cookie Configuration
Cookies have several configuration options; a brief summary of each option is given below. For more information, see RFC 6265 or Wikipedia.
newtype CookieDomain Source #
Examples:
"d123example.cl
oudfront.net"
"cloudfrontalia
s.example.com"
Time
data NominalDiffTime :: * #
This is a length of time, as measured by UTC. Conversion functions will treat it as seconds. It has a precision of 10^-12 s. It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), regardless of whether a leap-second intervened.
type POSIXTime = NominalDiffTime #
POSIX time is the nominal time since 1970-01-01 00:00 UTC
To convert from a CTime
or EpochTime
, use realToFrac
.
The time at which credentials begin to take effect
IP address
The IP address or address range of clients allowed to make requests
Strings
A space efficient, packed, unboxed Unicode text type.
data ByteString :: * #
A space-efficient representation of a Word8
vector, supporting many
efficient operations.
A ByteString
contains 8-bit bytes, or by using the operations from
Data.ByteString.Char8 it can be interpreted as containing 8-bit
characters.
Crypto
data PrivateKey :: * #
Represent a RSA private key.
Only the pub, d fields are mandatory to fill.
p, q, dP, dQ, qinv are by-product during RSA generation, but are useful to record here to speed up massively the decrypt and sign operation.
implementations can leave optional fields to 0.