microsoft/BotFramework-Hubot

Authentication

angegar opened this issue · 5 comments

Hi,
I am trying to use the embeded authentication mechanism but it seems that the "loadAuthorizedUsers" event is not triggered. Indeed i am able to retrive the admin list coming from the env var in test hubot command but for the authentication mechanism there is no admins. can someone confirm that this feature works as expected ?

Hi @angegar,

Were you able to receive messages when authorization wasn't enabled? Also are you able to receive the "unauthorized" error message?

I was able to stand up a fresh install of hubot using the authorization for this adapter and can confirm the event is triggered, but I did have trouble with the adapter using the wrong hubot in node_modules (the hubot in the node_modules of the adapter instead of the hubot in the node_modules of the hubot you're running), so it could be related to how the adapter and hubot were set up.

Here are the steps I used after cloning this repo to set up the hubot with the adapter:

  1. In your hubot directory, run npm install with a relative path to the cloned BotFramework-Hubot repo
  2. In the BotFramework-Hubot directory, run npm install --production
  3. In the BotFramework-Hubot directory, run npm install with a relative path to the hubot folder in the node_modules of your hubot directory.
    • So if your hubot's root directory is ~/myhubot and the adapter is in ~/BotFramework-Hubot, in the BotFramework-Hubot directory run npm install ../myhubot/node_modules/hubot

After that, I was able to configure the adapter and use the authorization to restrict who could send messages using the environment variable.

Hi @MSMeMend ,
Thank you for your answer. Does that mean that the following process does not work :

  • Install hubot
  • add hubot-botframework in the package.json>dependencies
  • run /bin/hubot -a hubot-botframework ?

If i correctly understood your proposal i should not rely on npm to install botframework but instead i have to manually download it and execute npm install

Hi,
Sorry but i am really stuck with this, thus please find below the dockerfile i used to run hubot + botframework :

FROM node:latest
LABEL maintainer="me"

# Update npm
RUN npm install npm@latest yo generator-hubot -g

RUN useradd hubot -m
USER hubot
WORKDIR /home/hubot

COPY "scripts/" "scripts/"
COPY "lib/" "lib/"
COPY "package.json" "./"

RUN yo hubot --name="bobot" --description="MyBot" --owner="me" --defaults &&\
    rm external-scripts.json && \
    rm hubot-scripts.json

COPY "external-scripts.json" "./"
RUN npm install --save

# Override adapter with --env-file ENV
ENTRYPOINT ["/home/hubot/bin/hubot","-a","botframework"]

The bot run and i am able to interact with it however the hubot-auth plugin as well as the hubot-msteams plugin does not works well. The hubot-msteam does not seem to run.

Thank you in advance for the help you may bring

Hi @angegar,

Correct, the version of the botframework adapter with authorization isn't published on npm, so you will have to install it as a local dependency. The same goes for hubot-msteams, it's not currently published on npm so you will have to install it as a local dependency.

Do you mind sharing your package.json and external-scripts.json as well? It would help with figuring out what is occurring.

closing due to inactivity