Java 如何配置Angular 2中开发的具有spring安全性的登录页面

Java 如何配置Angular 2中开发的具有spring安全性的登录页面,java,angular,spring-security,Java,Angular,Spring Security,我使用Angular 2和Spring Security创建了登录应用程序。在这里,我使用Angular2创建了登录页面,并保存在app文件夹中。当我单击submit表单的按钮时,它将调用login.componet.ts文件中定义的getLogin()方法。我打电话给服务部。但我的状态代码是0。如下 异常:URL为null的状态为0的响应 main.bundle.js:545 URL:null的状态为0的响应 <form id="login-form" class="login-form

我使用Angular 2和Spring Security创建了登录应用程序。在这里,我使用Angular2创建了登录页面,并保存在app文件夹中。当我单击submit表单的按钮时,它将调用login.componet.ts文件中定义的getLogin()方法。我打电话给服务部。但我的状态代码是0。如下 异常:URL为null的状态为0的响应 main.bundle.js:545 URL:null的状态为0的响应

<form id="login-form" class="login-form" (submit)="login()" method="POST">
        <input type="text" name="username" id="email"placeholder="Email Address" [(ngModel)]="username">
        <input type="password" name="password" id="password" placeholder="Password" [(ngModel)]="password">
        <a href="#">Forgot your password?</a>
        <button class="btn" type="submit" value="">SIGN IN</button>
</form>
服务:

getLogin(username,password):Observable<string> {
        let body = new URLSearchParams();
        body.set('username', username);
        body.set('password', password);
        let response = this.http.post(`${AppSettings.BACK_ENDPOINT}/login`,body);
        console.log("=======LoginService=======");
        return response.map(isAuthenticated);
      }

    }
    function isAuthenticated(response:Response):string {
      return response.json();
    }



 When client logged in successfully then Spring Security returning defaultSeccessURl and should redirect to that default success url.
    but its not happening when calling by calling above service
Please help me.
getLogin(用户名、密码):可观察{
let body=新的URLSearchParams();
body.set('username',username);
设置('password',password);
让response=this.http.post(`${AppSettings.BACK\u ENDPOINT}/login`,body);
console.log(“==========LoginService==========”);
返回response.map(已验证);
}
}
函数已验证(响应:响应):字符串{
返回response.json();
}
当客户端成功登录时,Spring Security将返回defaultSeccessURl,并应重定向到该默认成功url。
但通过调用上述服务调用时,不会发生这种情况
请帮帮我。

请将您的spring控制器和console.log${AppSettings.BACK\u ENDPOINT}AppSettings.BACK\u ENDPOINT=放入控制器spring安全内部映射,然后“/login”请将您的spring控制器和console.log${AppSettings.BACK\u ENDPOINT}AppSettings.BACK\u ENDPOINT=放入控制器spring安全内部映射,然后“/login”
getLogin(username,password):Observable<string> {
        let body = new URLSearchParams();
        body.set('username', username);
        body.set('password', password);
        let response = this.http.post(`${AppSettings.BACK_ENDPOINT}/login`,body);
        console.log("=======LoginService=======");
        return response.map(isAuthenticated);
      }

    }
    function isAuthenticated(response:Response):string {
      return response.json();
    }



 When client logged in successfully then Spring Security returning defaultSeccessURl and should redirect to that default success url.
    but its not happening when calling by calling above service
Please help me.