censored-raw-header


License

License

GroupId

GroupId

org.mdedetrich
ArtifactId

ArtifactId

censored-raw-header_2.11
Last Version

Last Version

0.4.0
Release Date

Release Date

Type

Type

jar
Description

Description

censored-raw-header
censored-raw-header
Project URL

Project URL

https://github.com/mdedetrich/censored-raw-header
Project Organization

Project Organization

org.mdedetrich
Source Code Management

Source Code Management

https://github.com/mdedetrich/censored-raw-header

Download censored-raw-header_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/org.mdedetrich/censored-raw-header_2.11/ -->
<dependency>
    <groupId>org.mdedetrich</groupId>
    <artifactId>censored-raw-header_2.11</artifactId>
    <version>0.4.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.mdedetrich/censored-raw-header_2.11/
implementation 'org.mdedetrich:censored-raw-header_2.11:0.4.0'
// https://jarcasting.com/artifacts/org.mdedetrich/censored-raw-header_2.11/
implementation ("org.mdedetrich:censored-raw-header_2.11:0.4.0")
'org.mdedetrich:censored-raw-header_2.11:jar:0.4.0'
<dependency org="org.mdedetrich" name="censored-raw-header_2.11" rev="0.4.0">
  <artifact name="censored-raw-header_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.mdedetrich', module='censored-raw-header_2.11', version='0.4.0')
)
libraryDependencies += "org.mdedetrich" % "censored-raw-header_2.11" % "0.4.0"
[org.mdedetrich/censored-raw-header_2.11 "0.4.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.11
com.typesafe.akka : akka-http_2.11 jar 10.1.9
com.typesafe.akka : akka-actor_2.11 jar 2.5.26
com.typesafe.akka : akka-stream_2.11 jar 2.5.26

Project Modules

There are no modules declared in this project.

Censored Raw Header

Censored raw header is a simple implementation of RawHeader which allows you to provide a custom .toString method. This is useful when it comes to censoring log output of headers of sensitive information, such as OAuth2 tokens.

Usage

Put this into your build.sbt

libraryDependencies ++= Seq(
  "org.mdedetrich" %% "censored-raw-header" % "0.5.0"
)

Then simply created your own custom CensoredRawHeader, i.e. if you want to store an OAuth2 token with implicit flow you might do the following

import akka.http.scaladsl.model.headers.CensoredRawHeader

val token: String = ??? // Some Token  

CensoredRawHeader("Authorization",
                        s"Bearer $token",
                        s"Bearer ${token.take(3)}...${token.takeRight(3)}")

This means that when someone accesses the raw value from within the CensoredRawHeader they will get the actual value, however if they call .toString on the CensoredRawHeader (or any data structure containing the CensoredRawHeader) it will print the first 3 characters of the token, then ... and then the last 3 values of the token

Versions

Version
0.4.0
0.3.0
0.2.0
0.1.0