mirror of https://github.com/apache/archiva.git
Adding login service for new webapp
This commit is contained in:
parent
338c198dc0
commit
8a2fbaaa1c
|
@ -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]
|
||||
|
|
|
@ -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 {
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
|
@ -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) { }
|
||||
}
|
|
@ -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();
|
||||
});
|
||||
});
|
|
@ -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) { }
|
||||
}
|
|
@ -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',
|
||||
|
|
|
@ -145,10 +145,22 @@
|
|||
<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>
|
||||
|
|
Loading…
Reference in New Issue