Identity Server 4 AuthorizationContext.PromptModes empty - identityserver4

I am using the oidc-client library to authorize with our own Identity Server 4. It is working fine and I need to extend the login functionality. I'd like to use the OIDC-Parameter "prompt". The parameter is sent correctly to the connect/authorize endpoint. When the Login-Method is called, I am trying to get the AuthorizationContext by calling
var context = await _interaction.GetAuthorizationContextAsync(vm.ReturnUrl);
var prompt = context.PromptModes;
_interaction is an instance of IIdentityServerInteractionService. The PromptModes are always empty. Is this the right way I am trying to access them?
Thank you

It looks like you check the value in an inappropriate place.
The answer for a similar question on Github was:
we have to remove the prompt parameter because we would otherwise run into an endless loop. You could save the parameter in a separate parameter I guess.

Related

Codenameone: AppArg is null on ios when app open via applink

When opening my ios app via an applink, as specified by associated domains feature, the AppArg is null.
The consecutive call of start() method, as described in this issue, does not occur.
In my case, start() is called only once, with a null AppArg, and that's it.
The first thing a do, in the start() method, is call
Display.getInstance().getProperty("AppArg",null);
This works fine when opening the app via a custom scheme, but not when opening via an applink.
Note: I use the ios.glAppDelegateBody and ios.afterFinishLaunching build hints to handle app open via push notification. I figured this might interfere with AppArg reading so I removed those temporarily and tried again, but to no avail.
Currently, the only solution I see is to write some native code and try to get the opening url this way, but I'd very much like for the AppArg to work as it states.
I've tested on iphone 6s with ios 15.1.
Update 3:
This problem occurs due to the call of the facebook sdk in the didFinishLaunchingWithOptions which causes the method to return NO, and that prevents continueUserActivity to execute and retrieve the launch url. The offending code is this:
return [[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
This code gets executed if the facebook.appIdbuild hint is present in the codenameone settings.
After I removed it, things started working.
However, you won't be able to do this if you actually use facebook connect.
Update 2
I added the following snippet to the apple-app-site-association file hosted on my domain, as per the documentation here.
"activitycontinuation": {
"apps": [ <id of my app> ]
}
It didn't work still.
The same documentation also states the an associated domain entitlement like this: activitycontinuation:example.com should be added. So I added it to the ios.associatedDomains build hint, along with the applinks, looking like this:
ios.associatedDomains=applinks:mydomain.com,activitycontinuation:mydomain.com
It still didn't work. The build suceeded, but I'm not sure that codename one is actually doing something with activitycontinuation service.
So, the problem is still not solved!
Update:
So, the flow start,stop,start only happens when the app is in background and gets opened via an applink click, and both times start is called with the AppArg populated with the applink. All well in this case.
However, if the app is closed, and opepend via applink click, start is called only once and the AppArg is null. Problem!
The method shouldApplicationHandleURL is never called. I implemented it on the main app class, returning true.
I have also tried adding native code to try to get the applink, for the case when the app was previously closed. I tried to add the code below to the glAppDelegateBody build hint, but the build failed complaining that the continueUserActivity is duplicate. The code used was something like this:
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
NSURL *url = userActivity.webpageURL;
// Handle url
return YES;
}
Currently, I'm running out of ideas. So, please, help. Thank you.
iOS uses a different mechanism for dealing with applinks than it does for custom app URL schemes, so it is likely that there is a race condition here -where start() is being called before the URL is provided to the app.
Try implementing the com.codename1.system.URLCallback interface in your main lifecycle class and implement the shouldApplicationHandleURL method. This should be called when an applink is processed.
The solution, in my case, was to remove the facebook.appId build hint from the condenameone_settings.properties. I wasn't using facebook anymore, but forgot about the build hint. After removing it, things started working.
Found about this here.
By adding the following code to the ios.afterFinishLaunching build hint, the AppArg will be populated at start with the app launchUrl (if any), regardless of the fact that facebook sdk is used or not:
NSDictionary *activityDictionary = [launchOptions objectForKey:UIApplicationLaunchOptionsUserActivityDictionaryKey];
if (activityDictionary) {
NSUserActivity *userActivity = [activityDictionary valueForKey:#"UIApplicationLaunchOptionsUserActivityKey"];
if (userActivity != nil) {
if ([NSUserActivityTypeBrowsingWeb isEqualToString:userActivity.activityType] && userActivity.webpageURL != nil) {
JAVA_OBJECT launchUrlStr = fromNSString(CN1_THREAD_GET_STATE_PASS_ARG [userActivity.webpageURL absoluteString]);
JAVA_OBJECT appArgKey = fromNSString(CN1_THREAD_GET_STATE_PASS_ARG #"AppArg");
JAVA_OBJECT displayInstObj = com_codename1_ui_Display_getInstance__(CN1_THREAD_GET_STATE_PASS_SINGLE_ARG);
com_codename1_ui_Display_setProperty___java_lang_String_java_lang_String(CN1_THREAD_GET_STATE_PASS_ARG displayInstObj, appArgKey, launchUrlStr);
}
}
}

Close method not working in Office

Im trying to use Microsoft.Office.Interop.Word._Document.Close() in a .net 3.5 windows form app.
No matter how much I search here and on Google I cannot find the correct parameters to put in the Close method.
I am using version 14.0.0.0 of Microsoft.Office.Interop.Word and I would like to close the document without saving and ideally ensure that the application can isolate the document thread so that users can still open word documents outside the running application.
See the Close method of the Document class described in MSDN. If you need to omit the parameter and use the default value - pass the Type.Missing parameter.
Try this:
object doNotSaveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;
object missing = System.Reflection.Missing.Value;
_Document.Close(ref doNotSaveChanges, ref missing, ref missing);
This is the source
I'm not sure if you'll need the middle line or not. It's not from the original source it's from here

Getting $http.put() to send correctly formatted data, instead of JSON object

So, I spent some time and built a quick API for a project that I'm doing for myself.
I used the Postman add-on for Chrome to mimic PUT and DELETE quests to make sure everything worked correctly. Really happy I did that, as I learned a lot about PHP's shortcomings with PUT and DELETE requests.
Using the API I've had working with Postman, I started moving everything over to AngularJs controllers and such.
I'm trying to get a user to claim a row in a database as the login information for the users is different than this particular information. I couldn't figure out why the put requests to claim the row in my database wasn't working. Lo and behold, the data being parsed from my parsestr(file_get_contents('php://input')) had 1 array key, which was a JSON string.
I've looked, and I can't seem to find a solid answer either through Stackoverflow or Google (maybe I missed it somewhere in the config options), So my question is this: is there any way I can get the $http.put call send the data to the server correctly?
Thanks to user Chandermani for pointing me to the link at this URL which answered the base of my question.
From the above link, I found myself on This Blog post submitted by another user. In the end, what I ended up doing was the following:
taking param() function from the above link, as well as implementing these lines of code:
var app = angular.module('ucpData', [] , function($httpProvider){
$httpProvider.defaults.transformRequest = [function(data) {
return angular.isObject(data) && String(data) !== '[object File]' ? param(data) : data;
}];
});
Is how I worked around the problem. For some developers, you may actually want to keep the default transformRequest settings, but for the project I am doing I know that I will end up forgetting to call param() at some point, and my server doesn't naturally accept json data anyway. I would caution future developers to consider what they are attempting to do before they alter the transformRequest array directly.

cakephp url append invalid parameter But still work. Should be 404 page not found

I find a problem when i develop application via cakephp.
for example: my url is http://localhost/controller/view/id this is working fine.
BUT, when i append more invalid parameter, it still works,
like http://localhost/controller/view/id/adfasd/adfasdf/asdfasdf/asdfasdf
It should show up 404 page not found.
Shall i need to use $this->passedArgs to check pass parameter manually in controller then throw exception? Or is there any configuration?
How can i deal with this case
Thank you
You should first look here Cakephp, Routing-Named params to find out how to properly use them.
As you should add which one to use, you should also add a regex to your id in the route.
Also when sending the data to an action you should throw the exception there like it is explained here: cakephp deal with passing wrong parameter in url

Passing parameters to ->redirect() via $_GET

Hi I have this sentence
$g->addButton('')->set('NEW ACTIVITY')->js('click')->univ()->redirect('newactivity');
Is it possible to call the "redirect" method and passing parameters via $_GET ? so in the page "newactivity" I can ask for $_GET['something'] ?
Something like this
$g->addButton('')->set('NEW ACTIVITY')->js('click')->univ()->redirect('newactivity?id=1'); (this doesn't work)
or
$g->addButton('')->set('NEW ACTIVITY')->js('click')->univ()->redirect('newactivity','id=1');
Thanks
What you need is to properly build destination URL.
http://agiletoolkit.org/learn/understand/page/link
->univ()->redirect($this->api->getDestinationURL('newactivity',array('id'=>1)));
using stickyGET will affect ALL the urls you are going to produce form this point on. So if you add 2 links, each of them would be passing ID.
stickyGET is better if you need to pass argument which was already passed through GET, such as
array('id'=>$_GET['id']);
Here is a place where other ATK4 Developers chat too, perhaps another resource for your ATK4 Q's. https://chat.stackoverflow.com/rooms/2966/agile-toolkit-atk4

Resources