Posts

Unable to have a secure and non secure endpoint in a single Oauth secured Spring controller -

i putting rest api using spring boot secured via oauth2. have security application built working fine managing jwt tokens. i putting separate application handle general user profile resource requests such forgot password, registration , profile operations. annotated enableoauth2resource correctly adding oauth2authenticationprocessingfilter filter chain. @springbootapplication @enableoauth2resource public class profileapplication extends springbootservletinitializer { public static void main(string[] args) throws ioexception { springapplication.run(profileapplication.class, args); } @override protected springapplicationbuilder configure(springapplicationbuilder application) { return application.sources(profileapplication.class); } } the challenge facing cannot find way configure security post requests /profiles endpoint unsecured while requests or put pass in derived @authenticationprincipal provided bearer token. i want have following i...

python - Pyramid and Cassandra don't work properly -

i using pyramid (1.5.7) , waitress (0.8.9) cassandra (2.2.0) . seems waitress , cassandra driver using both asyncore , somehow stepping on each others toes. code on app/__init__.py file: import logging.config .action.context import root_factory pyramid.config import configurator cassandra.cluster import cluster cassandra.query import named_tuple_factory def main(global_config, **settings): """ function returns pyramid wsgi application.""" # support logging in python3 logging.config.fileconfig( settings['logging.config'], disable_existing_loggers=false ) config = configurator(settings=settings, root_factory=root_factory) # retrieves connection cassandra (non sql database) def get_non_sql(request): cluster = cluster(['127.0.0.1'], port=9042) session = cluster.connect('app') def disconnect(request): cluster.shutdown() request.add_finished...

php - how to save date for the second run of my application -

here did: $time1 = date('h:i'); $time2 = null; $time_array = array($time1, $time2); $time1 current time. every time run script, shows moment. i explain want do: at t=0 (initial) (first time run code) $time1 = 10:14:26; (the date value want saved use of second run of code) i think want use session variables. remember, if user has cookies or private browsing enabled not work. session_start(); if (isset($_session['time_1'])) { $time2 = $_session['time_1']; } $_session['time_1'] = date('h:i'); $time_array = array($_session['time_1'], $time2);

python - How to I hide my secret_key using virtualenv and Django? -

i using django, python, virtualenv, virtualenvwrapper, , vagrant. so far have left secret_key inside of settings.py file. works file local files. have placed files in git. know not acceptable production(apache). what correct way go hiding secret_key? should use virtualenv hide it? there's lot of different methods hide secrets. use another, non-versioned file. create new file secrets.py or have , put secrets in that. place alongside settings file , place secret in there; in settings file put from secrets import * @ top. then, rahul said, add .gitignore file , add secrets.py file won't committed. the disadvantage of approach there no source control @ on file; if lose you're sol. use environment variables. use apache setenv or passenv directives pass environment variables process, retrieve them os.environ() in settings file. has advantage in in development, can set new variables (as var1=whatever var2=whatever ... ./manage.py runserver ....

visual studio - Object reference not set to an instance of an object error on updating NuGet package -

hi have updated manage nuget package , vs 2013 give "object reference not set instance of object" error whenever run program. tried find solution failed. uninstalled vs , reinstall. error same on making new project. i had same issue , forced revert earlier version of nuget. v2.8.6 has imposed dependency on .net 4.5+ in point release - bad behavior imho. see nuget 2.8.6 causing dependency on .net 4.5+?

ruby on rails 4 - ec2 instance unreachable from browser with rails4 -

Image
first, read found problem still stuck, launch ec2 instance, security group port 80 open, ssh (22) , icmp (-1) i can ping ip, works well, can ssh, no problem, when wget http://localhost on instance it's working well it's rails application launch sudo rails s -p80 (to on port 80) have err_connection_refused when nstat on instance got : so guess port 80 not open have no idea how fix this. anyhelp ? thx are using rails 4.2.x? defaults listen on localhost interface. can use sudo rails s -b 0.0.0.0 -p80 tell listen on interfaces , should accessible externally.

c++ - uniqueness of struct names -

while name of structure must unique in set of structures within namespace, such name can "shared" variables , functions. example, following code compiles fine: // code 1 struct h{}; int h{ 8 }; similarly, there no collision in: // code 2 struct h{}; void h(){} 1) reasoning allow name sharing? moreover, if throw templates mix, have strange situations. code // code 3 template< class h > void h(){} struct h{}; template< class h > struct j{}; void j(){} does compile; following code fails: // code 4 struct h{}; template< class h > void h(){} void j(){} template< class h > struct j{}; 2) why reasoning allowed code 2 not enough allow code 4? not asking rules in standard. asking reason behind rules. 1) reasoning allow name sharing? according "the design , evolution of c++", bjarne stroustrup , section 2.8.2 "structure tags vs. type names", feature introduced maintain compatibility c. c language requires...