Search Posts

Category: java

Secure way to send a mail via a (Restful) Webservice

I have a AngularJS Webapplication with Java Backend. Now i want to send a mail out of the Angular Application. I thought the best way is to send a post or get request to the webservice and send the Mail via an internal smtp server to the recipient. But i think there is a big security problem with this concept. When i create a webservice call like: /api/mail?mailto=john@doe.com someone can take the link to the […]

Attaching attribute to RequestContext – pass element from frontend to backend

I have written frontend in angularjs and backend in spring-boot. I need to pass some attribute from backend to frontend. This attribute is some configuration set from frontend should be passed with each request to backend. When it comes to authorization we are using LDAP. The whole aim is to be able to do: String myConf = RequestContextHolder.getRequestAttributes().getAttribute( “myConf”, RequestAttributes.SCOPE_REQUEST); I have no idea how to do it. Can you help me, please? Source: AngularJS

AngularJS – HTTP GET request with status code 302

I am building a RESTful API using AngularJS, and i got stuck. I am trying to send a GET request which will fetch me a User with given username. Here is the code: var loginModule = angular.module(‘login-module’, []); loginModule .factory(‘loginService’,[‘$http’,’$rootScope’, function($http){ var factoryMethods = {}; factoryMethods.login = function(username){ return $http.get(‘http://localhost:8080/WebProjekat/webapi/users/’+username); } factoryMethods.setLoggedUser = function(user){ $rootScope.loggedUser = user; } return factoryMethods; }]) .controller(‘loginController’, [‘$scope’, ‘$http’,’loginService’, function ($scope, $http, loginService){ $scope.username = ”; $scope.password = ”; $scope.user […]

spring security with angularJS web app and android app

I have been working on a medical emergency project, which involves the use of android app to send alerts and a web app (AngularJS) as a control centre that can see alerts, location of request and keeps tracking the location, BackEnd is java maven I have code in github Github.com/EmanBsisou Sos: contains backend in java and front end in static folder SOSApp has the android mobile app code The problem is that it was working […]

NgWebDriver waitForAngularRequestsToFinish() is not working

I am trying to implement NgWebDriver using Selenium Java for angular app. As per NgWebDriver documentation we have to only pass new NgWebDriver(driver).waitForAngularRequestsToFinish(); driver instance but when I am trying to implement it , I have to cast argument to JavascriptExecutor otherwise its giving error in the syntax. System.setProperty(“webdriver.chrome.driver”, “/path/to/chromedriver”); WebDriver d = new ChromeDriver(); NgWebDriver ngdriver = new NgWebDriver((JavascriptExecutor) d); ngdriver.waitForAngularRequestsToFinish(); When I use this code after casting driver instance as than its not […]