]> source.dussan.org Git - archiva.git/commitdiff
Adding login service for new webapp
authorMartin Stockhammer <martin_s@apache.org>
Sun, 19 Jul 2020 11:27:03 +0000 (13:27 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Sun, 19 Jul 2020 11:27:03 +0000 (13:27 +0200)
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app.module.ts
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/general/login/login.component.ts
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/archiva-request.service.spec.ts [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/archiva-request.service.ts [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/login.service.spec.ts [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/login.service.ts [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/environments/environment.ts
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml

index e991091b0049868b3201f49b301c4262fd9cbf10..270aa431bc2d84849b523203acaa09d2d18b0c48 100644 (file)
@@ -18,6 +18,7 @@
  */
 import { BrowserModule } from '@angular/platform-browser';
 import { NgModule } from '@angular/core';
+import { HttpClientModule } from '@angular/common/http';
 
 import { AppRoutingModule } from './app-routing.module';
 import { AppComponent } from './app.component';
@@ -43,6 +44,7 @@ import {FormsModule} from "@angular/forms";
     BrowserModule,
     AppRoutingModule,
     FormsModule,
+    HttpClientModule,
   ],
   providers: [],
   bootstrap: [AppComponent]
index bb018b6a63c4586dda08877753542c36754e529b..97c0020b81b5da6f17d490fc3536c0b14d1c793a 100644 (file)
@@ -20,6 +20,7 @@ import { Component, OnInit } from '@angular/core';
 // noinspection ES6UnusedImports
 import { FormsModule } from "@angular/forms";
 import { Logindata } from "../../../logindata";
+import { LoginService } from "../../../services/login.service";
 
 @Component({
   selector: 'app-login',
@@ -36,7 +37,11 @@ export class LoginComponent implements OnInit {
 
   get diagnostic() { return JSON.stringify(this.submitted); }
 
-  constructor() {  }
+  login(): void {
+    this.loginService.login(username, password);
+  }
+
+  constructor(private loginService: LoginService) {  }
 
   ngOnInit(): void {
   }
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/archiva-request.service.spec.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/archiva-request.service.spec.ts
new file mode 100644 (file)
index 0000000..159b1ee
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { TestBed } from '@angular/core/testing';
+
+import { ArchivaRequestService } from './archiva-request.service';
+
+describe('ArchivaRequestService', () => {
+  let service: ArchivaRequestService;
+
+  beforeEach(() => {
+    TestBed.configureTestingModule({});
+    service = TestBed.inject(ArchivaRequestService);
+  });
+
+  it('should be created', () => {
+    expect(service).toBeTruthy();
+  });
+});
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/archiva-request.service.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/archiva-request.service.ts
new file mode 100644 (file)
index 0000000..8bbfc04
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Injectable } from '@angular/core';
+import { HttpClient } from "@angular/common/http";
+import { environment } from "../../environments/environment";
+
+@Injectable({
+  providedIn: 'root'
+})
+export class ArchivaRequestService {
+
+
+  executeRestCall(type: string, module: string, service: string, input: object, callback: (result: object) => void ) : void {
+    let modulePath = environment.application.servicePaths[module];
+    let url = environment.application.baseUrl + environment.application.restPath + "/"+modulePath+"/" + service + "Service";
+    if (type == "get") {
+      this.http.get(url,)
+    } else if ( type == "post") {
+      this.http.post(url);
+    }
+  }
+
+  constructor(private http : HttpClient) { }
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/login.service.spec.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/login.service.spec.ts
new file mode 100644 (file)
index 0000000..c75cae2
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { TestBed } from '@angular/core/testing';
+
+import { LoginService } from './login.service';
+
+describe('LoginService', () => {
+  let service: LoginService;
+
+  beforeEach(() => {
+    TestBed.configureTestingModule({});
+    service = TestBed.inject(LoginService);
+  });
+
+  it('should be created', () => {
+    expect(service).toBeTruthy();
+  });
+});
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/login.service.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/login.service.ts
new file mode 100644 (file)
index 0000000..99937d5
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Injectable } from '@angular/core';
+import { ArchivaRequestService } from "./archiva-request.service";
+
+
+@Injectable({
+  providedIn: 'root'
+})
+export class LoginService {
+
+  login(username: string, password: string) {
+
+      throw new Error("Method not implemented.");
+  }
+
+  constructor(private archiva : ArchivaRequestService) { }
+}
index 50fea53585a8884332b440bb8a9a5fd897aaed20..605dc26cc553dc97e7d4273e575bf208aab7d1df 100644 (file)
@@ -25,6 +25,13 @@ export const environment = {
   production: false,
   application:
   {
+    baseUrl: 'http://localhost:8080',
+    restPath: '/restServices',
+    servicePaths: {
+      archiva:"archivaServices",
+      redback:"redbackServices",
+      ui:"archivaUiServices"
+    },
     name: 'archiva-starter',
     angular: 'Angular 10.0.2',
     bootstrap: 'Bootstrap 4.5.0',
index e7152779f4d2f8662dc0cf106e352c7feab25308..fa04fc60537da079b9f91692224f3891a9328fe8 100644 (file)
     <load-on-startup>1</load-on-startup>
   </servlet>
 
+  <servlet>
+    <servlet-name>CXFServletV2</servlet-name>
+    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+
   <servlet-mapping>
     <servlet-name>CXFServlet</servlet-name>
     <url-pattern>/restServices/*</url-pattern>
   </servlet-mapping>
+
+  <servlet-mapping>
+    <servlet-name>CXFServletV2</servlet-name>
+    <url-pattern>/api/*</url-pattern>
+  </servlet-mapping>
   
   <welcome-file-list>
     <welcome-file>index.html</welcome-file>