Get Full Username of Logged In User - dominotogo

Is there a way to the full username of an authenticated user? I want to return: CN=Ryan Buening/OU=ABC/O=Acme
dtgSession.username returns the abbreviated username: 'Ryan Buening'

No, this is not possible in Domino To Go at this time. dtgSession.username only returns what you have set with dtgSession.setUsername() before.
To get the canonicalized name, DTG would need to make a HTTP request in order to ask Domino for the name. That would be possible, but is not implemented yet.
Update: Domino To Go 2.0 will have a new method notesSession.evaluate() which can be used to evaluate an #formula like "#UserName" and thus get the canonical user name.

I'm not sure what language you are programming in, and what interface you have. From the question, I assume that this is somewhat resembling LDAP (or Active Directory) interface. Being familiar with LDAP, I'll suggest you try using the Distinguished Name or DN. According to the syntax, this should look like any of the following:
dtgSession.DN
dtgSession.dn
dtgSession.Dn
dtgSession.DistinguishedName
dtgSession.distinguishedname
dtgSession.distinguishedName
Check this out for an explanation of DN. Don't confuse this with RDN, as this is the Relative Distinguished Name and probably not what you're looking for.
I hope this helps :)

Related

How to validate top level domain for validity and existence?

There are so many top level domains these days, like .xxx, .club and so on.
How do I check if some domain's top-level domain is correct and exists?
For example, mydomain.xyz. I can cut off mydomain. and check the rule against xyz. Should I get a full list somewhere? I suppose it's not 100% guaranteed as the list can grow over time?
Or may be I should use some remote API for this?
I found this one http://data.iana.org/TLD/tlds-alpha-by-domain.txt and it seems to be the one that I hope is updated regularly. Is it a good enough source?
Please advise.
If you want to check a given string to see if there is a currently existing TLD with that name, you can send an NS query for the name to the root servers and see if they give you a sensible answer. If they do, the TLD exists. If they do not, it does not exist.
If you want a list of all currently existing TLDs, the URL you give in your question is indeed the correct place to get one. As the first line in the file indicates, it does get updated regularly.

Forcing Users to Log on for a particular XPage: Is the <xp:aclEntry> tag flaky?

I have a 'Registration' XPage for which I want the end-user to be logged in. Normal users can browse the database, but when they need to register, then I want them to register.
I have been using the the xp:aclEntry tag to control this
<xp:this.acl>
<xp:acl>
<xp:this.entries>
<xp:aclEntry
type="ROLE"
loaded="true"
right="EDITOR">
<xp:this.name><![CDATA[[CreateAnmeldung]]]></xp:this.name>
</xp:aclEntry>
</xp:this.entries>
</xp:acl>
</xp:this.acl>
but now I'm getting this
Even though I would argue that the user has that role:
Oliver Busse suggested in an earlier question of mine to avoid the aclEntry tag and instead do some code in the beforePageLoad event. Is this correct best practice?
Or, have I missed something?
Andrew,
Best practice is always up for debate, but I agree with Oliver that you should check in your beforePageLoad and redirect in that manner. I have never used the <xp:aclEntry> myself, so I can't directly tell you whether it is flakey.
In this example, I check for Anonymous, but it sounds like your check will be different. If using in this manner then you MUST allow public access on the XPage. (I am adding this because it is often missed)
//Check Access level, if Anonymous, redirect them to login page.
if (context.getUser().getCommonName() == "Anonymous"){
context.redirectToPage("/~~~/~~~.nsf/login.xsp");
}
In addition, please see Oliver's answer on a better way to determine the access level: XPages: context.getUser().getRoles() working sporadically
I haven't used this yet, and had no problems using the code above, but remembered that this came up recently. Edit: Just saw this was your question, so safe to say you know about it :), but leaving for posterity.

Removing ids from url [duplicate]

Hey guys! Working on a new Cake app and wondering if there is anyway for me to remove the ID-in-URL routing from Cake. Perhaps by passing the ID in POST somehow? Having the ID passed in as a URL param just seems really shoddy and unsafe. Thanks!
"Shoddy"? It's standard practice and a perfectly fine solution to have ids in the URL. Look at the URL of your question:
http://stackoverflow.com/questions/4638262/removing-id-from-cakephp-url
^^^^^^^
id
Also, there's absolutely nothing unsafe about showing an id in a URL. It's just a number that doesn't mean anything. If a user can do something "bad" only by knowing this id, your app is broken and insecure, not the id-passing mechanism.
Trying to work around this scheme means working around the fundamental principle of the HTML protocol and opens up a whole new can of worms.
Some people prefer using slugs instead of primary key ids. This is the removing-id-from-cakephp-url part of the URL from this page. Take a look at the SluggableBehavior.
However, slugs can change. Hence, having the primary key in your URL is useful if you want to have a permalink. StackOverflow does both so that it can support both permalinking from other sites, as well as for SEO reasons. :)
Regarding security issues, I guess the other answers have already pointed out that there are other ways to make your application secure.
Why do you care? URL-s are optimized for SEO reasons, an ID won't matter if it's ain't too long. If the latter, consider using a shorter one with numbers and letters in them instead, it will be as difficult to guess as a long one with just numbers.
If you are not using GET and you do not supply the params in the URL, your users won't be able to copy-paste the location.

Adding hyphens in domain name registrations

I wanted to register a domain name for myself but as usual could not get exactly the name I wished for.
Ex: 11minutes.com was what I wanted.
But I found a very similar one with a hyphen in between.
Ex:11-minutes.com
Are there any disadvantages to buying this domain ?
One down side is that people looking for the 11-minutes version might type the other variant into their browser address bar and go to the wrong site.
Another is that if the version already registered is a trademark in the same business as you, they could decide you're infringing and have your domain taken away.
It's better to have something distinct in most cases.

gmail username syntax method for spam prevention

i'm very aware that this is probably not a stackoverflow question, but i figure someone here might know the answer...
a few months back i was sent an image detailing a neat method for spam prevention using a little known feature of gmail..
basically you can use a specific syntax in your email address when you give it out to include some kind of identifier within the email address so you can later distinguish which version of your email address was distributed/crawled to create spam and then, if you want, create filters based on this identifier.
something along the lines of username|identifier#gmail.com which will still beforewarded to username#gmail.com except | is not the correct token and i can't find the doco where i found this information or remember what the correct special character is.
so if anyone knows about the feature i'm describing, i'd love to find out how to get it to work!
thanks, and sorry for the non-programming question.
p.
Use a + sign instead of the |

Resources