1 package org.apache.archiva.rest.services.v2;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
21 import io.restassured.response.Response;
22 import org.junit.jupiter.api.AfterAll;
23 import org.junit.jupiter.api.BeforeAll;
24 import org.junit.jupiter.api.DisplayName;
25 import org.junit.jupiter.api.MethodOrderer;
26 import org.junit.jupiter.api.Tag;
27 import org.junit.jupiter.api.Test;
28 import org.junit.jupiter.api.TestInstance;
29 import org.junit.jupiter.api.TestMethodOrder;
30 import org.junit.jupiter.api.extension.ExtendWith;
31 import org.springframework.test.context.ContextConfiguration;
32 import org.springframework.test.context.junit.jupiter.SpringExtension;
34 import static io.restassured.RestAssured.given;
35 import static io.restassured.http.ContentType.JSON;
36 import static org.junit.jupiter.api.Assertions.*;
39 * @author Martin Stockhammer <martin_s@apache.org>
41 @TestInstance( TestInstance.Lifecycle.PER_CLASS )
43 @TestMethodOrder( MethodOrderer.Random.class )
44 @DisplayName( "Native REST tests for V2 SecurityConfigurationService" )
45 public class NativeSecurityConfigurationServiceTest extends AbstractNativeRestServices
48 protected String getServicePath( )
54 void setup( ) throws Exception
60 void destroy( ) throws Exception
62 super.shutdownNative( );
66 void testGetConfiguration() {
67 String token = getAdminToken( );
68 Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON )
72 .then( ).statusCode( 200 ).extract( ).response( );
73 assertNotNull( response );
74 assertEquals( "jpa", response.getBody( ).jsonPath( ).getString( "active_user_managers[0]" ) );
75 assertEquals( "jpa", response.getBody( ).jsonPath( ).getString( "active_rbac_managers[0]" ) );
76 assertEquals( "memory", response.getBody( ).jsonPath( ).getString( "properties.\"authentication.jwt.keystoreType\"" ) );
77 assertEquals("10",response.getBody( ).jsonPath( ).getString( "properties.\"security.policy.allowed.login.attempt\""));
78 assertTrue( response.getBody( ).jsonPath( ).getBoolean( "user_cache_enabled" ) );
79 assertFalse( response.getBody( ).jsonPath( ).getBoolean( "ldap_active" ) );