Liking cljdoc? Tell your friends :D

puppetlabs.trapperkeeper.authorization.ring-middleware


add-authinfoclj

(add-authinfo request allow-header-cert-info oid-map)

Inputs: [request :- ring/Request allow-header-cert-info :- schema/Bool oid-map :- acl/OIDMap] Returns: ring/Request

Add authentication information to the ring request.

Inputs: [request :- ring/Request allow-header-cert-info :- schema/Bool oid-map :- acl/OIDMap]
Returns: ring/Request

Add authentication information to the ring request.
sourceraw docstring

add-rbac-subjectclj

(add-rbac-subject request token->subject)

Inputs: [request :- ring/Request token->subject :- (schema/maybe IFn)]

Inputs: [request :- ring/Request token->subject :- (schema/maybe IFn)]
sourceraw docstring

assoc-query-paramsclj

(assoc-query-params request)

Associate a query-params map onto the supplied request from any key/value pairs embedded in the request's URL query string.

Associate a `query-params` map onto the supplied request from any
key/value pairs embedded in the request's URL query string.
sourceraw docstring

authorization-checkclj

(authorization-check request
                     rules
                     oid-map
                     allow-header-cert-info
                     rbac-is-permitted?
                     token->subject)

Inputs: [request :- ring/Request rules :- [rules/Rule] oid-map :- acl/OIDMap allow-header-cert-info :- schema/Bool rbac-is-permitted? :- (schema/maybe IFn) token->subject :- (schema/maybe IFn)] Returns: rules/AuthorizationResult

Checks that the request is allowed by the provided rules and returns an authorization result map containing the request with authorization info added, whether the request is authorized, and a message.

Inputs: [request :- ring/Request rules :- [rules/Rule] oid-map :- acl/OIDMap allow-header-cert-info :- schema/Bool rbac-is-permitted? :- (schema/maybe IFn) token->subject :- (schema/maybe IFn)]
Returns: rules/AuthorizationResult

Checks that the request is allowed by the provided rules and returns an
 authorization result map containing the request with authorization info
 added, whether the request is authorized, and a message.
sourceraw docstring

header->certclj

(header->cert header-cert-val)

Return an X509Certificate or nil from a string encoded for transmission in an HTTP header.

Return an X509Certificate or nil from a string encoded for transmission
in an HTTP header.
sourceraw docstring

header-cert->pemclj

(header-cert->pem header-cert)

URL decode the header cert value into a PEM string.

URL decode the header cert value into a PEM string.
sourceraw docstring

header-cert-nameclj

Name of the HTTP header through which a client certificate can be passed for a request.

Name of the HTTP header through which a client certificate can be passed
for a request.
sourceraw docstring

header-client-verify-nameclj

Name of the HTTP header through which a client verify can be passed for a request.

Name of the HTTP header through which a client verify can be passed
for a request.
sourceraw docstring

header-dn-nameclj

Name of the HTTP header through which a client dn can be passed for a request.

Name of the HTTP header through which a client dn can be passed
for a request.
sourceraw docstring

legacy-openssl-dn->cnclj

(legacy-openssl-dn->cn dn)

Attempt to parse the supplied 'dn' string as a legacy OpenSSL-style DN, where the attributes in the DN are delimited by solidus characters, and return back the value for a CN attribute found within it. For example, if the supplied 'dn' were '/O=myorg/CN=myname', then the value returned would be 'myname'. If a value for the CN attribute cannot be found, either because the original format of the 'dn' wasn't in the legacy OpenSSL-style or no CN attribute was found within the 'dn', this function would return nil.

Attempt to parse the supplied 'dn' string as a legacy OpenSSL-style DN,
where the attributes in the DN are delimited by solidus characters, and
return back the value for a CN attribute found within it.  For example,
if the supplied 'dn' were '/O=myorg/CN=myname', then the value returned
would be 'myname'.  If a value for the CN attribute cannot be found, either
because the original format of the 'dn' wasn't in the legacy OpenSSL-style
or no CN attribute was found within the 'dn', this function would return
nil.
sourceraw docstring

pem->certsclj

(pem->certs pem)

Convert a pem string into certificate objects.

Convert a pem string into certificate objects.
sourceraw docstring

request->certclj

(request->cert request allow-header-cert-info)

Inputs: [request :- ring/Request allow-header-cert-info :- schema/Bool] Returns: (schema/maybe X509Certificate)

Pull the client certificate from the request. Response includes the certificate as a java.security.cert.X509Certificate object or, if none can be found, nil. allow-header-cert-info determines whether to try to pull the certificate from an HTTP header (true) or from the certificate provided during SSL session negotiation (false).

Inputs: [request :- ring/Request allow-header-cert-info :- schema/Bool]
Returns: (schema/maybe X509Certificate)

Pull the client certificate from the request.  Response includes the
certificate as a java.security.cert.X509Certificate object or, if none
can be found, nil.  allow-header-cert-info determines whether to try to
pull the certificate from an HTTP header (true) or from the certificate
provided during SSL session negotiation (false).
sourceraw docstring

request->extensionsclj

(request->extensions request allow-header-cert-info oid-map)

Inputs: [request :- ring/Request allow-header-cert-info :- schema/Bool oid-map :- acl/OIDMap] Returns: acl/Extensions

Given a request, return a map of shortname -> value for all of the extensions in the request's certificate. Uses the passed oid map to translate from OIDs to short names.

Inputs: [request :- ring/Request allow-header-cert-info :- schema/Bool oid-map :- acl/OIDMap]
Returns: acl/Extensions

Given a request, return a map of shortname -> value for all of the extensions
in the request's certificate. Uses the passed oid map to translate from OIDs
to short names.
sourceraw docstring

request->nameclj

(request->name request allow-header-cert-info)

Pull the common name from the request, considering whether or not the name should be pulled from headers or an SSL certificate (per the allow-header-cert-info setting).

Pull the common name from the request, considering whether or not the
name should be pulled from headers or an SSL certificate (per the
allow-header-cert-info setting).
sourceraw docstring

request->name*clj

(request->name* request header-dn-val allow-header-cert-info)

Pull the common name from the request, considering whether or not the name should be pulled from headers or an SSL certificate (per the allow-header-cert-info setting). header-dn-val is the value of the DN in an HTTP header for the request, if available.

Pull the common name from the request, considering whether or not the
name should be pulled from headers or an SSL certificate (per the
allow-header-cert-info setting).  header-dn-val is the value of the
DN in an HTTP header for the request, if available.
sourceraw docstring

verified?clj

(verified? request name allow-header-cert-info)

Determine if the user's identity has been 'verified'. When 'allow-header-cert-info' is set to 'true', the user's identity is assumed to be verified externally and, so, whatever the 'x-client-verify' header value is for the request is assumed to be the result of that verification. 'SUCCESS' is the only value for a successful verification in that case; anything else is considered to be 'not verified'. When 'allow-header-cert-info' is set to 'false', the user's identity (or lack thereof) is assumed to have been verified by the server in which this code is running, in which case a value of 'true' is always returned

Determine if the user's identity has been 'verified'.  When
'allow-header-cert-info' is set to 'true', the user's identity is assumed
to be verified externally and, so, whatever the 'x-client-verify' header
value is for the request is assumed to be the result of that verification.
'SUCCESS' is the only value for a successful verification in that case;
anything else is considered to be 'not verified'.  When
'allow-header-cert-info' is set to 'false', the user's identity (or lack
thereof) is assumed to have been verified by the server in which this
code is running, in which case a value of 'true' is always returned
sourceraw docstring

warn-for-empty-common-nameclj

(warn-for-empty-common-name common-name empty-message)

Log a warning message if the supplied common-name is empty (nil or empty string.

Log a warning message if the supplied common-name is empty (nil or empty
string.
sourceraw docstring

warn-if-header-value-non-nilclj

(warn-if-header-value-non-nil header-name header-val)

Log a warning message if the supplied header-val is non-empty.

Log a warning message if the supplied header-val is non-empty.
sourceraw docstring

wrap-authorization-checkclj

(wrap-authorization-check handler
                          rules
                          oid-map
                          allow-header-cert-info
                          rbac-is-permitted?
                          token->subject)

Inputs: [handler :- IFn rules :- [rules/Rule] oid-map :- acl/OIDMap allow-header-cert-info :- schema/Bool rbac-is-permitted? :- (schema/maybe IFn) token->subject :- (schema/maybe IFn)] Returns: IFn

Middleware that checks if the request is allowed by the provided rules, and if not returns a 403 response with a user-friendly message.

Inputs: [handler :- IFn rules :- [rules/Rule] oid-map :- acl/OIDMap allow-header-cert-info :- schema/Bool rbac-is-permitted? :- (schema/maybe IFn) token->subject :- (schema/maybe IFn)]
Returns: IFn

Middleware that checks if the request is allowed by the provided rules,
 and if not returns a 403 response with a user-friendly message.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close