Opcsoft Rewrite: redirect to subdomains / custom portal - redirect

I´m trying to do the following scenarios:
In my app I have an entity like "CustomerPortal". A user from my app can have a customer portal which has an ID.
myapp.com/portal/customerportal?id=123456 -> This is than the customer portal from User1.
My user has also customers. For those customers my user don´t like to share the url like: myapp.com/portal/customerportal?id=123456
So he would like to have some URL like: portal.mycustomerdomain.com
The customer portal has also subpages, like:
myapp.com/portal/customerportal/page1.jsf
myapp.com/portal/customerportal/page2.jsf
etc.
All subpages should redirect than also to:
portal.mycustomerdomain.com/page1
portal.mycustomerdomain.com/page2
Is there a config needed with Opcsoft Rewrite?
How should this look like?
Is there also some settings needed from my users his customer on his webpage?
Like some redirects (A records etc.)?
I found a website which are doing something like I would like to do:
https://scrappbook.zendesk.com/hc/de/articles/4403073986961-Starte-hier-Domain-anbinden
(Sorry it´s in German)
I checked also the documentation, but seems like also the forum and links a broken.
Therefore in general some question:
Direction.isOutbound() vs Direction.isInbound()
-> What´s the different? When do I use which one?
Domain.matches("username")
-> What does this mean? "matches" ?
SendError.code from which package does SendError comes from?
Many thanks for help

Related

Facebook OAuth SSO Issue

I have a JavaEE Application. I am trying to implement OAuth.
But I am facing some strange issues:
As per the documentation to manually building the sign in web flow I have to provide a link like this https://www.facebook.com/dialog/oauth?client_id=1231298371123&display=popup&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fc%2Fportal%2Fauth%2Ffacebook_login%3F&scope=email,public_profile,user_birthday&response_type=code%20token which will open the dialog. But the dialog is not opening.
And when the SSO is successful FB is redirecting to the url given above but the problem is FB is appending the query strings like state, code, etc with #. Something like: http://localhost:8080/c/portal/auth/facebook_login?#state=ASDASDASDASD&access_token=EAANXZAlBTi........ Because for this I cannot get the parameters in Java.
Do any one came across this kind of issue.
Please help.
Not sure if I understood the question right but if you want to read the string after # you can use the following code
URI uri = new URI("http://test.com/#something=some");
String fragment = uri.getFragment();
fragment will be everything after #

Linkedin API - get company ID from url

Is there a way to get the numeric company ID from the URL of a company page on Linkedin? This ID is the one I'll use to query the Linkedin API and get more information on the company.
I need to get the ID from the information provided with the URL, to use it to get the rest of the information related to the company page.
It seems unusual to me that you need to dig in the HTML code to get the company ID you need to use to interact using the Linkedin API, so correct me if I'm wrong.
I know there have been similar request handlers, but I'm wondering why there isn't a handler available to get the company ID like there is to get the profile id from its url:
https://api.linkedin.com/v1/people/url=xxxx
I know there is the search company handler, but that is a text based research and I found myself with some inconsistent results from time to time.
I don't want to crawl the company page for the ID since I get blacklisted by Linkedin if I do it too many times from the same IP address.
I am aware of these answers:
how to get companies id from linkedin jsapi
How to get the company id from Linkedin Company URL in PHP?
LinkedIn API for Company Directory
But they seem outdated or marginally related to what I ask and since LI API has changed much over the past year, if there was any development on this.
EDIT: added more info on the kind of ID I am looking for. I had erroneously marked #display's answer as correct but unfortunately it's not what I am looking for. I am referring to the companyId that I'd use to query the Linkedin API concerning that company.
June 2020 Update
Most of the above methods no longer work, including using the jobs page URL and hovering over search results. The 2019 update by #rinogo almost works. To make it easier, paste this script into the console. Of course, updates from LinkedIn may case this to fail eventually.
(() => {
const name = document.location.pathname.replace(/^\/[^\/]*\/([^\/]*)\/?/, '$1');
for (let json of Array.from(document.querySelectorAll('code'))) {
try {json = JSON.parse(json.innerText);} catch (e) {json = null;}
if (json && json.included) {
for (let incl of json.included) {
if (incl.universalName === name && incl.objectUrn) {
return 'Company ID for [' + incl.universalName + '] is [' + incl.objectUrn.substr('urn:li:company:'.length) + ']';
}
}
}
}
return 'Company ID not found';
})();
2020 update
Please see Whatabrain's answer.
2019 update
Arbitrary Pages
The solutions provided previously are outdated. The following is not the best solution, but it will work in a pinch. It does require "crawling", unfortunately. (I know this doesn't answer OP's question, but it should help others who arrive here since this is the top Google result)
View the HTML source for the "home page" of the company whose ID you are trying to discover. Search for the string, https://www.linkedin.com/company/. The first instance of this string on the page is followed immediately by the company ID.
You can verify that you have the right company ID by visiting the entire link (including the Company ID), e.g. https://www.linkedin.com/company/123456.
If this approach stops working at some point, please comment below and I'll update this answer.
UPDATE: I'm using the strategy today (7/2/2019) and am finding that the last instance is currently more reliable due to some changes made by LinkedIn. Ultimately, the overall strategy remains sound. View the source and find some repeatable way to search for the company ID. It may take some experimentation to find a reliable approach.
Pages with admin rights
If you have admin rights to the Page, finding the Company ID is trivial. While signed in, visit your Company Page. The Company ID is used right within the URL.
For example:
Admin URL for Company Page: https://www.linkedin.com/company/123123123/admin/
Company ID: 123123123
Or, you can of course use the API to find the Company ID for any Company Page of which you are an admin.
We can obtain the company id from the url of a company page. For this we must have a valid linkedin account.
Once you are in the company page, just check the url
https://www.linkedin.com/company/123456
The numbers given as 123456 is the respective company id.
Hope that you meant this company id.
The way I got the ID is by going to the page, and clicking "View Jobs" (as long as they have some).
Then the URL will have the ID on it:
https://www.linkedin.com/jobs/search?locationId=OTHERS.worldwide&f_C=12345678
To find your LinkedIn company ID:
Open LinkedIn in a new tab
In your search results, select your company page.
Navigate to the URL at the top of your company page.
Copy the number immediately following 'www.linkedin.com/company/' but before the question mark.
Solution provided by: https://support.klipfolio.com/hc/en-us/articles/216181827-Use-LinkedIn-as-a-data-source
Anyone still looking a solution, please follow:
Go to https://developer.linkedin.com/plugins/company-profile
Type the name of the company in the Company Name box and it will suggest the name.
Once you select the Company page, click on Get Code button.
You will get the company page id with data-id.
Screenshot:
Successfully used this method 2/27/2019.
Search for the company in LinkedIn.com
When located in search window, HOVER over the company name.
Locate ID at the bottom showing where the URL will direct.
Hovered over company name in top arrow, gathered ID in displayed URL at bottom arrow
I have a much easier solution that works! (15/01/2019)
Go to the company's page e.g. https://www.linkedin.com/company/something
Then view the source (CTRL+U in Chrome). Search for the expression "company/". The second match contains the ID! Have fun.

Parse Signup Problems

So, I wanted to create a new social media app using Swift and Parse. When I go to the Parse site, and click on dashboard, it gives me a login screen. I don't have an account, so I click on the "I don't have a parse account" button. When I click on that, it just takes me back to the home page. I did manage to get the code and frameworks and stuff that I needed from the docs, but that didn't quite work. It gave me this for the initialize code:
let configuration = ParseClientConfiguration {
$0.applicationId = "YOUR_APP_ID"
$0.server = "http://YOUR_PARSE_SERVER:1337/parse"
}
In the tutorial I'm watching, rather than "YOUR_APP_ID" and "http://YOUR_PARSE_SERVER:1337/parse" it just had a bunch of letters and numbers, which I would assume are the app ID and Parse server. My guess is, that I need an account to get those. Would that be correct? And, does anyone know why I can't seem to get an account? Thanks.
Parse.com is shutting down, so that's why you are not allowed to create new accounts on the service. Check the blog post.
They open sourced a nodeJS implementation, which you should definitely check out at link, and here is an example to get you started. You can easily use the deploy buttons to host the server on services like Heroku, AWS, Azure, etc. You can also deploy a server locally, for testing purposes.
Although it's true that Parse is discontinuing early next year, you can still setup a new app if you want to use the service for a shorter term project. Replace your code with the following.
Parse.setApplicationId("YOUR-APP-ID", clientKey: "YOUR-CLIENT-ID")
You can find your App ID and Client ID in your app's settings > security & keys.
EDIT: You definitely need an account for this to work.

Yammer REST API - Documented Parameter not working

The API documented here - http://developer.yammer.com/restapi/#rest-users clearly states:
"4) Alias to /api/v1/users/current user’s id.format. Supports include_followed_users, include_followed_tags, and include_group_memberships parameters.
GET https://www.yammer.com/api/v1/users/by_email.json?email=user#domain.com`
Yet, when we try this, it does not return any followed user information at all! The request we're using is like so:
https://www.yammer.com/api/v1/users/by_email.json?email=me#company.com&include_followed_users=true
However, this request DOES return followed users, but only for the current user:
https://www.yammer.com/api/v1/users/current.json?include_followed_users=true
Am I missing something completely obvious and being stupid or is there a real issue here? If this was taken out for whatever reason, then you'd have thought that the API documentation would have been updated.
The Yammer Team did eventually get back to me on this. Their response below:
(I've removed https://www.yammer.com from URLs because I don't have enough rep' to post more links)
Hey Jason Dunbar looks like the documentation here is wrong.
I looked in to this and had some conversations with a few engineers this week and have the following (albeit more arduous workaround):
1) Call get user by email endpoint and retrieve the id attribute from here: /api/v1/users/by_email.json?email=user…
2) To grab following users, take that id and:
GET /api/v1/users/following/[:id].json
3) To grab group memberships for that user you'll need to impersonate him/her (verified admin only) and
GET /api/v1/users/current.json
We'll get the documentation updated ASAP with this. Also happy to keep the conversation going to help if needed.
Make sure you are setting the email parameter to the user's email that they are registered with.
E.G. if your company has multiple domains but the Yammer network is under bigco.com and the user is registered with an email under bigcosubsidiary.com you'll need to make a request to the API with user#bigcosubsidiary.com.
-as mentioned - it looks like its only for current.json - you can check it here http://yammer-dev.herokuapp.com/endpoints/4 - hope it helps.
Rich

TYPO3 fe_user: Log in as two different users at the same time possible?

One of our clients wants to FE log in as two different users at the same time, using one browser. I think this is only possible when using two different browser. IS there any workaround?
Background is this: We wrote a FE extension where user can login and update some of their data. One client is a kind of superuser/admin. He wants to compare and edit data of several users at once.
Authentication in TYPO3 is performed by cookie fe_typo_user and therefore it is not possible to have two users logged in at same time from same browser.
You may advise to use different browsers or virtual machines for your client.
As Viktor wrote - it's not possible. Here I should finish the answer.
Anyway... while you are creating your own plugin you can easily add 'simulate mode' using for an example custom cookies... Block schema is:
[IF isAdmin AND simulateMode == false] {
Display admin's version
} [ELSE] {
Display common user's version
}
You can go even farther and switch the admin to simulate some chosen 'common' user, anyway make sure that will not violate some privacy police.