Is it possible expose Saml2Constants.AuthenticationScheme? - itfoxtec-identity-saml2

I want to have different cookie name, but re-write Saml2ServiceCollectionExtensions.AddSaml2 and Saml2ResponseExtensions.CreateSession seems not very good just for change cookie name,
so it will be better to expose schema name and we can set it in appsetting.json.

You are right is is currently not possible to set the cookie name in the Saml2ServiceCollectionExtensions.AddSaml2 method. You are welcome to du a pull-request adding the feature.

Related

mgt-react PeoplePicker defaultSelectedUsers not working as I would expect

I've been writing a React app that relies on the mgt-react components.
The app is basically just an interface to a SharePoint library.
Everything has been working great and the PeoplePicker is working in so much as I can start typing a users name and the drop down works and I can select a person.
However now I'm at the point where I want to create an edit screen. In order to implement this I need to prepopulate the PeoplePicker with the users that were input at insert time.
I can't seem to get the "defaultSelectedUsers" property to work.
I've pared things down to simply hardcoding a users email address and it still doesn't work.
Here is my code for the component (email address changed for privacy reasons):
<PeoplePicker defaultSelectedUsers={['user#domain.com']} selectionMode="single" selectionChanged={handleSelectionChanged}></PeoplePicker>
No matter what I do it is not prepopulating with a user / person.
The permissions are all there (I think) which is proven by the component working when I start typing a user name.
Any ideas what I might be missing?
As always thanks so much for any input in advance.
----- edit ----
Oh okay, it seems that I can't use that prop with mgt-react? I have to use defultSelectedUserIds and can't just provide an email address. Can someone confirm this is the case?
Is there mgt documentation for the defaultSelectedUsers property? As far as I am aware, the people picker only supports defaultSelectedUsersById. The email address should work though, assuming the graph is able to retrieve the users (it's their actual id).
For a quick test, are you able to retrieve the users through the graph explorer with the /users/${id} (replace id with your email) filter? This is what we use for the property.

External access settings for Office 365 groups

I'm trying to update GroupSettings of individual O365 Group, however I always get error
Resource 'guid' does not exist or one of its queried reference-property objects are not present.
A code I'm using to update the group settings
var graphResult = graphClient.GroupSettings[guid].Request().UpdateAsync(groupSetting).GetAwaiter().GetResult();
I've tried to use Group guid as well as GroupSettings guid, none of that worked.
I can set the settings for the first time (overwrite defaults) using codde below, but update doesn't work afterwards.
graphResult = graphClient.Groups[guid].Settings.Request().AddAsync(groupSetting).GetAwaiter().GetResult();
Any idea what can be wrong please?
Thanks
You should use GroupSettings guid here.
I can repro your issue when I use an incorrect guid here.
You should firstly use GET https://graph.microsoft.com/v1.0/groupSettings to find the GroupSettings guid of the GroupSetting you want to update.
Please note that you should include all the values in the request body even though you don't want to update some of them.
Then you could put it as the guid in your code.
It's stronly recommended to have a quick test in Microsoft Graph Explorer.
Since documentation doesn't say how to update settings for particular group, here it is: you need to use both IDs in call
graphResult = graphClient.Groups[groupGuid].Settings[settingsGuid].Request().UpdateAsync(groupSetting)

Drupal7 Displayed Username different from Username Entry Field

On our Drupal 7 site, we're trying to force Drupal to use a certain username- First Name, Last Initial - no matter what the user puts in the username field on the user form. Currently, there are fields for Username, First Name, and Last Name. Does anyone have an easy way to do this? It would also be nice if the user profile's URL would take be forced to use the Drupal-created username.
I've looked around and haven't seen any questions on this- let me know if I missed one!
There is a module that do just that RealName and it fairly easy to use and this is the documentation for the module if needed.
and you can alter the user profile link with Pathauto to what ever you want.

CakePHP a class that can be used anywhere?

I have a multi-domain site. Depending on the domain the site needs to behave accordingly.
I created a helper called CompanyInfo it has methods such as name(), phone(), email(), etc.
Depending on what domain you are on it returns the correct information.
So for example if I need to display the phone number for a user to call I would use $this->CompanyInfo->phone() and it will display the correct phone number for the user depending on the domain.
Ok, this is all good, but not really relevant. The real issue is, I need this information in more than just the view. Helpers are just for views though. If I want to access this information from a controller I need to create a component to do it.
I really don't want to have a Helper and a Component doing the same thing. I would rather have one class handle it rather than copy and paste logic.
So whats the best way to have a class with methods that can be accessed from the controller or view or even model?
Is it just this kind of static information (name, phonenumber, email, etc) what you need to display? Why not just add them to your configuration in core.php?
Something like
# in core.php
Configuration::write('Company.name', 'Acme Corp.');
Configuration::write('Company.email', 'joe#acme.com');
You can then get this info anywhere you need using
Configuration::read('Company.name');
You can define this variable in your app_controller and then use these variable easily in any of your controller as set these variables from there only.
Call this function in your construct class.
i think that will solve your problem.
You can access model classes from any place this way :
$companyInfoModel = ClassRegistry::init('CompanyInfo');
$phone = $companyInfoModel->phone();
a) you can use libs in cake1.3 for that
b) static model methods which you can pass the content to and which will return the expected value
echo Model::phone($data)

Elegant way to store anonymous users with nick names in django?

I have a simple Post model in my django app:
class Post(models.Model):
category = models.CharField(max_length=10, choices=choices)
message = models.CharField(max_length=500)
user = models.ForeignKey(User, editable=False)
I'd like to implement the feature of having anonymous users create posts with nick names. Unfortunately django doesn't allow you to save an instance of AnonymousUser as a foreignkey to the Post class.
I was thinking of adding a "dummy" user record into the db that represents the anonymous user(id=0, or some negative number if possible) that would be used for all posts without a user. And if it is present a nullable name field would be used to represent the nickname of the anonymous user.
This solution seems a bit hacky to me. Is there any cleaner more effecient solution?
If you can identify new users by some session information, you could just create normal user accounts, pro forma so to speak - with a flag to identify them as volatile (this may lead to some regular maintenance cleanup).
If, during session lifetime, the user actually want to register, you can reuse the user account on your side and the user can keep all his data on his.
As #slacy commented and #Dominique answered; instead of rolling your own take a look at existing projects, e.g. this:
http://www.stereoplex.com/blog/introducing-django-lazysignup
Not tested , but this can help:
https://github.com/danfairs/django-lazysignup
You can add blank=True and null=True to User ForeignKey and set it to None, if user is anonymous. You just need to store the nickname somewhere.
I am new to Django. A friend told me not to use ForeignKey further stating that using CharField is ok. ForeignKey is slower than CharField, as it has some check for user info.

Resources