Visit my.sonatype.com for documentation on Nexus Repository version 2.
You'll need to provide an implementation of the org.sonatype.security.usermanagement.UserManager API (you can extend AbstractReadOnlyUserManager if you just want to lookup users and not edit/add them).
Add code to return populated User objects on request, use the same @Named value as your realm (best practice is to use the same name as your realm) - this will then get picked up along with all the other UserManager implementations which are then aggregated in Nexus Repository 2.
Override getAuthenticationRealmName and return your realm ID, and this is used to associate the usermanager with the realm behind the scenes.
For Nexus Repository 2.8/2.9 you need to build your plugin with nexus-plugin-bundle-maven-plugin 1.2. See the example projects for examples:
https://github.com/sonatype/nexus-example-plugins
A shipped example realm implementation is the rutauth realm. You can use the various branches to check for any differences that were required as the versions of Nexus Repository 2 changed:
https://github.com/sonatype/nexus-oss/tree/nexus-2.7.x/plugins/security/nexus-rutauth-plugin https://github.com/sonatype/nexus-oss/tree/nexus-2.8.x/plugins/security/nexus-rutauth-plugin https://github.com/sonatype/nexus-oss/tree/nexus-2.9.x/plugins/security/nexus-rutauth-plugin