Package

com.lookout.borderpatrol

auth

Permalink

package auth

This provides the specification contracts for doing auth in the form of Type Classes in auth.Access and auth.Identity

Taking SAML 2.0 and OAuth2 as example flows, we have defined a set of contracts and abstractions on those contracts to allow users of this library to implement instances of their specific authentication/authorization.

The flow for a typical SAML/OAuth2 involves a protected resource, a client (web browser), and an Identity Provider. Border Patrol can act as a translation layer for external representation of access and internal representation so that services behind it do not need to implement SAML/OAuth2.

The primary abstractions are:

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. auth
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. trait Access[A] extends AnyRef

    Permalink

    Abstraction for some access data, e.g.

    Abstraction for some access data, e.g. service token, grant, role, scope

  2. case class AccessFilter[A, B](binder: MBinder[ServiceIdentifier])(implicit statsReceiver: StatsReceiver) extends Filter[AccessIdRequest[A], Response, AccessRequest[A], AccessResponse[B]] with Product with Serializable

    Permalink

    This filter acquires the access and then forwards the request to upstream service

    This filter acquires the access and then forwards the request to upstream service

    binder

    It binds to the upstream service endpoint using the info passed in ServiceIdentifier

  3. case class AccessIdRequest[A](req: Request, customerId: CustomerIdentifier, serviceId: ServiceIdentifier, sessionId: SignedId, id: Id[A]) extends Product with Serializable

    Permalink
  4. trait AccessIssuer[A, B] extends Service[AccessRequest[A], AccessResponse[B]]

    Permalink

    Describes a service that acts as an Access issuing endpoint, this would be something like an OAuth2 token service, or an LDAP server, or a database that holds access tokens for user credentials

  5. trait AccessRequest[A] extends AnyRef

    Permalink

    The identification information needed by the AccessIssuer to issue access data for your request

    The identification information needed by the AccessIssuer to issue access data for your request

    This can be thought of as a function (A, ServiceIdentifier) => Req

  6. trait AccessResponse[A] extends AnyRef

    Permalink

    This response contains the access data needed by an authenticated endpoint, e.g.

    This response contains the access data needed by an authenticated endpoint, e.g. grants, tokens, api keys

  7. case class BorderRequest(req: Request, customerId: CustomerIdentifier, serviceId: ServiceIdentifier, sessionId: SignedId) extends Product with Serializable

    Permalink
  8. case class BpAccessIssuerError(status: Status, msg: String) extends BpAuthError with Product with Serializable

    Permalink

    This exception stores the response code

  9. class BpAuthError extends Exception

    Permalink
  10. case class BpCertificateError(msg: String) extends BpAuthError with Product with Serializable

    Permalink

    Certificate processing error

  11. case class BpIdentityProviderError(status: Status, msg: String) extends BpAuthError with Product with Serializable

    Permalink

    This exception stores the response code

  12. case class BpTokenParsingError(msg: String) extends BpAuthError with Product with Serializable

    Permalink

    Token Parsing error

  13. case class BpVerifyTokenError(msg: String) extends BpAuthError with Product with Serializable

    Permalink

    Certificate processing error

  14. case class CustomerIdFilter(matcher: ServiceMatcher)(implicit statsReceiver: StatsReceiver) extends Filter[Request, Response, CustomerIdRequest, Response] with Product with Serializable

    Permalink

    Determines the service that the request is trying to contact If the service doesn't exist, it returns a 404 Not Found response

  15. case class CustomerIdRequest(req: Request, customerId: CustomerIdentifier) extends Product with Serializable

    Permalink

    PODs

  16. case class ExceptionFilter() extends SimpleFilter[Request, Response] with Product with Serializable

    Permalink

    Top level filter that maps exceptions into appropriate status codes

  17. case class Id[+A](id: A) extends Identity[A] with Product with Serializable

    Permalink
  18. trait IdentifyRequest[A] extends AnyRef

    Permalink

    A request to gain an Identity, e.g.

    A request to gain an Identity, e.g. email/password credentials

    Note: this wouldn't be used for most cases of something providing external authentication, like in the case of SAML, since the user would have been redirected to an external IdP for logging in.

  19. trait IdentifyResponse[A] extends AnyRef

    Permalink

    A response from the identity provider with some identity

    A response from the identity provider with some identity

    Example: SAML POST response to a successful login to a third party IdP

  20. sealed trait Identity[+A] extends AnyRef

    Permalink

    This encapsulates the notion of an identifier that the AccessIssuer can understand.

    This encapsulates the notion of an identifier that the AccessIssuer can understand. In the case of OAuth2 we would wrap a the Access Token grant, or for SAML we would wrap the SAML token, then we hand this off to the AccessIssuer

  21. case class IdentityFilter[A](store: SessionStore)(implicit evidence$1: SessionDataEncoder[A], secretStore: SecretStoreApi, statsReceiver: StatsReceiver) extends Filter[BorderRequest, Response, AccessIdRequest[A], Response] with Product with Serializable

    Permalink

    Determines the identity of the requester, if no identity it responds with a redirect to the login page for that service

  22. trait IdentityProvider[A, B] extends Service[IdentifyRequest[A], IdentifyResponse[B]]

    Permalink

    Abstraction for those that are directing requests directly to the Identity Provider

  23. case class LogoutService(store: SessionStore)(implicit secretStore: SecretStoreApi) extends Service[CustomerIdRequest, Response] with Product with Serializable

    Permalink

    Logout Service - Deletes the session - sets the empty cookie in response - redirects to default service path

  24. case class RewriteFilter() extends SimpleFilter[BorderRequest, Response] with Product with Serializable

    Permalink

    This filter rewrites Request Path as per the ServiceIdentifier configuration

  25. case class SendToAccessIssuer(accessIssuerMap: Map[String, Service[BorderRequest, Response]])(implicit statsReceiver: StatsReceiver) extends SimpleFilter[SessionIdRequest, Response] with Product with Serializable

    Permalink

    Send the request on AccessIssuer chain

    Send the request on AccessIssuer chain

    This filter only deals with Authneticated SessionIds or forwards it to next filter

  26. case class SendToIdentityProvider(identityProviderMap: Map[String, Service[BorderRequest, Response]], store: SessionStore)(implicit secretStore: SecretStoreApi, statsReceiver: StatsReceiver) extends SimpleFilter[SessionIdRequest, Response] with Product with Serializable

    Permalink

    Send the request on IdentityProvider chain

  27. case class SendToUnprotectedService(serviceBinder: MBinder[ServiceIdentifier], store: SessionStore)(implicit secretStore: SecretStoreApi, statsReceiver: StatsReceiver) extends SimpleFilter[SessionIdRequest, Response] with Product with Serializable

    Permalink

    Send the request to Unprotected Service

    Send the request to Unprotected Service

    This filter only deals with the Request has SessionId (Authenticate or Untagged) and destined to unprotected Service. Everything else is forwarded to the next filter in the chain.

  28. case class SessionIdFilter(matcher: ServiceMatcher, store: SessionStore)(implicit secretStore: SecretStoreApi, statsReceiver: StatsReceiver) extends Filter[CustomerIdRequest, Response, SessionIdRequest, Response] with Product with Serializable

    Permalink

    Ensures we have a SignedId present in this request, sending a Redirect to the service login page if it doesn't

  29. case class SessionIdRequest(req: Request, customerId: CustomerIdentifier, serviceIdOpt: Option[ServiceIdentifier], sessionIdOpt: Option[SignedId]) extends Product with Serializable

    Permalink
  30. implicit final class TryOps[A] extends AnyVal

    Permalink

Value Members

  1. object Access

    Permalink
  2. object AccessIdRequest extends Serializable

    Permalink
  3. object AccessRequest

    Permalink
  4. object BorderAuth

    Permalink
  5. object BorderRequest extends Serializable

    Permalink
  6. object EmptyIdentity extends Identity[Nothing] with Product with Serializable

    Permalink
  7. object Identity

    Permalink
  8. object OAuth2

    Permalink
  9. object SessionIdRequest extends Serializable

    Permalink
  10. def wrapFuture[A](f: () ⇒ A, onFailure: (String) ⇒ Throwable): Future[A]

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped