Skip to content

Commit

Permalink
Add testing steps for running with identity enabled and security plug…
Browse files Browse the repository at this point in the history
…in installed

Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Jan 20, 2023
1 parent 601106a commit 7de61c0
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 4 deletions.
64 changes: 64 additions & 0 deletions sandbox/libs/authn/docs/IDENTITY_TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
## Testing with Security Plugin installed

Assemble a local distribution of core:

```
./gradlew localDistro
```

Navigate to the platform specific distribution:

```
cd distribution/archives/<platform>/build/install/opensearch-<version>-SNAPSHOT
```

### Assemble the Security Plugin

Checkout the security repo: https://github.com/opensearch-project/security

Run gradlew assemble:

```
./gradlew assemble
```

### Install the Security Plugin

In the root directory of the local distribution built in core, run:

```
./bin/opensearch-plugin install --verbose file:<path-to-opensearch-security>/build/distributions/opensearch-security-<version>-SNAPSHOT.zip
```

to install the security plugin. Answer yes to the prompt. The step above may require the use of `sudo`

Navigate to the security plugin tools directory:

```
cd plugins/opensearch-security/tools
```

and run the install_demo_configuration script:

```
./install_demo_configuration.sh
```

and answer yes to all prompts.

Go back up to the root directory by running: `cd ../../..`

and open the `opensearch.yml` file:

```
vim config/opensearch.yml
```

and enter the following lines:

```
identity.enabled: true
identity.auth_manager_class: org.opensearch.identity.authmanager.internal.InternalAuthenticationManager
```

Note that `identity.auth_manager_class` is optional and will default to the InternalAuthenticationManager. Use this setting if you would like to use a non-default AuthenticationManager.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

package org.opensearch.authn;

import java.util.Objects;

/**
* Application wide access for identity systems
*
Expand All @@ -25,6 +27,7 @@ private Identity() {}
* Gets the Authentication Manager for this application
*/
public static AuthenticationManager getAuthManager() {
Objects.requireNonNull(AUTH_MANAGER, "Auth Manager has not been set");
return AUTH_MANAGER;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class NoopAuthenticationManager implements AuthenticationManager {

@Override
public Subject getSubject() {
System.out.println("NoopAuthenticationManager.getSubject");
return new NoopSubject();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.identity.noop;
package org.opensearch.identity.authmanager.noop;

import org.opensearch.test.OpenSearchTestCase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
* compatible open source license.
*/

package org.opensearch.identity.noop;
package org.opensearch.identity.authmanager.noop;

import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.authn.Subject;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

public class NoopSubjectTests extends OpenSearchTestCase {
Expand Down

0 comments on commit 7de61c0

Please sign in to comment.