Skip to content

Latest commit

 

History

History
55 lines (43 loc) · 1.93 KB

README.adoc

File metadata and controls

55 lines (43 loc) · 1.93 KB

Config Based Auth for the Micronaut Framework

This module provides an implementation of Micronaut Security’s AuthenticationProvider which loads principal information from application configuration.

This is useful for providing basic principal information for security-enabled services. Instances such as:

  • Prototyping of security-enabled services without setting up an auth system

  • Providing a mechanism for testing security-aware code

WARNING: This module does not make any attempt to encode, encrypt, or otherwise obfuscate any information. In particular, account information for publicly available systems should never be stored in ways that make it discoverable to audiences that should not have that information.

General Configuration

In a Micronaut Framework application with a security feature enabled:

First, add mn-config-based-auth to your project dependencies

implementation("com.github.jasontypescodes:mn-config-based-auth:2.1.0")

Next, configure your principals. The example below will show configuration in YAML, but any Micronaut configuration mechanism should work.

config-based-auth:
  enabled: true # Must explicitly be enabled
  accounts:
    alice: # If no identity is provided, this key is treated as the identity
      secret: shh
      roles:
        - VIEW
        - COMMENT
        - CREATE
        - DESTROY
      attributes:
        favorite_color: pink
    bob:
      identity: bob@test.test
      secret: abc123
      roles:
        - VIEW
        - COMMENT
      attributes:
        favorite_color: brown
Table 1. Version Compatibility

Version

Micronaut Version

1.x.x

2.x.x

2.x.x

3.x.x