Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

com.github.robtimus:obfuscation-spring

Package Overview
Maintainers
1
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.github.robtimus:obfuscation-spring

Provides Spring and Spring Boot obfuscation support

  • 2.3
  • Source
  • Maven

Version published
Maintainers
1
Source

obfuscation-spring

Maven Central Build Status Quality Gate Status Coverage Known Vulnerabilities

Provides Spring and Spring Boot obfuscation support.

Add obfuscation-spring-boot-starter as a dependency to your project to get the following:

  • Autowire support for Obfuscator.
    Instances of Obfuscator can be autowired in two ways:

    • Annotate an autowired field, constructor argument or method argument with any of the obfuscator annotations of obfuscation-annotations, and an instance of the matching obfuscator will be autowired.
    • With no obfuscator annotation present, a default obfuscator is used.
  • Autowire support for Obfuscated.
    Declaring an autowired field, constructor argument or method argument as Obfuscated will automatically wrap the autowired field or argument. This supports both autowired values and beans.
    The obfuscator to use is determined in one of two ways:

    • Annotate the field or argument with any of the obfuscator annotations of obfuscation-annotations to use the matching obfuscation rules.
    • With no obfuscator annotation present, a default obfuscator is used.

    The character representation can be specified using @RepresentedBy. If this annotation is not present, the default character representation is used.

Examples:

@Autowired
@ObfuscateFixedLength(8)
private Obfuscator obfuscator;

@Autowired
private Obfuscator defaultObfuscator;

@Value("${property}")
@ObfuscateFixedLength(8)
private Obfuscated<String> obfuscatedValue;

@Autowired
@ObfuscateFixedLength(8)
@RepresentedBy(MyCharacterRepresentation.class)
private Obfuscated<MyBean> obfuscatedBean;

Default obfuscator

Out-of-the-box, the default obfuscator is Obfuscator.fixedLength(3). This can be overridden in two ways:

  • Provide a custom bean of type Obfuscator.
  • Define the default obfuscator in the application properties. See Properties for more information.

ObfuscatorProvider implementations

If an ObfuscatorProvider type is already available as a bean, this bean will be used. Otherwise, the type is instantiated using Spring's own bean factory. This allows implementations to use autowired fields.

Vanilla Spring

The automatic support for autowiring Obfuscator and Obfuscated only works when using obfuscation-spring-boot-starter. To add obfuscation support to vanilla Spring:

FAQs

Package last updated on 27 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc