Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

MS SQL Server Authentication

Avatar

Level 2

How can I allow only users in my MS SQL server database to log into my simple chat room?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Employee

The compatibilty is between 1.8.x and 1.9.x. The scripts should work well with 1.8.6 or 1.8.7.

The rails app was generated with Rails 2.3.4 but Rails 2.3.5 should work too (if you change the required version in config/environment.rb).

Anyway, I just installed Ruby 1.9.x on my mac and run a quick test. The only error reported where on case/when and in one call to the REXML API.

I am attaching an updated version here, if you want to give it a quick try (but again, I only run a basic test that calls all the APIs with basic parameters).

View solution in original post

9 Replies

Avatar

Employee

You need to use the server APIs and specificially external authentication.

A couple of use cases:

- you have one single chat room and just want to accept only authenticated users : users login on your site (for example through an HTML form). Once they are logged in you generate an external authentication token and launch them into your Flex application (and you can embed the token in a server-generate HTML page and pass it as FlashVars)

- you have multiple rooms, for example each user or a select group of users "own" a room and a different set of users can participate to the chat: in this case you'll probably have users accessing specific room URLs. You will still authenticate them and if valid you can check if the user is the owner of that particular room or a valid participant. If one of the two you can generate the external authentication token with the appropriate role (owner or participant or whatever role you want your users to have in the room) and again send them into the room with the valid token.

There are a few examples that comes with the SDK. Check the folder sampleApps/ExternalAuthentication.

The "rails" folder contains a Ruby on Rails application that let you add users to a database (with a specific room created for each user) and join rooms either as the owner or as a participant.

The other examples are more basic and mainly show you how to create an external authentication token given a user and a role.

Avatar

Level 2

I could not get the rails example to work.  It throws a couple of errors pointing to lib/lccs.rb and lib/lccs_helper.rb.  In lib/lccs_helper.rb, what information should replace the entries below?

RTC_ACCOUNT = "http://connectnow.acrobat.com/<YOURACCOUNT>"

RTC_SECRET = "<YOURSHAREDSECRET>"

RTC_LOGIN = "<YOUREMAIL>"

RTC_PASSWORD = "<YOURPASSWORD>"

Thanks

Avatar

Former Community Member

Hi,

In the RTC_ACCOUNT, you should enter your account url. If you login to the developer portal, you will see the account url in the left side below in a textbox.

In another text box just below that url, you will see the account shared secret key, which you have to put in RTC_SECRET.

Your login is your email address , so put that in RTC_LOGIN and lastly in RTC_PASSWORD , put your password.

Hope this helps

Thanks

Hironmay Basu

Avatar

Level 2

Hi,

Thanks for your reply.

I entered the login information but still get some errors.  Have you tested the sample? I wonder if it works.  What links should I enter in the web browser?  Everything is in my development box.  So I was entering links like http://127.0.0.1/rooms, http://127.0.0.1/users.

Thanks

Avatar

Employee

Yes, we tested the example and it works.

If you don't tell us what kind of errors you get it's very difficult to help you out.

Also, I am not sure where you got those URLs. Did you follow these instructions (from the file README.LCCS in the rails folder) :

In order to run this application:

- run "rake db:migrate" to create the database schema

- edit lib/lccs_helper.rb and update the account and developer information

This application uses the "authlogic" gem.

Please install it using by running "gem install authlogic" or "rake gems:install"

Now you are ready to run the server (  run "script/server" ) and access it at http://localhost:3000/

Avatar

Level 2

I got the urls where you got http://localhost:3000.  Mine uses ip instead.  Anyway, here is the error:

SyntaxError in RoomsController#index

C:/Rails/rails/lib/lccs.rb:377: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
C:/Rails/rails/lib/lccs.rb:408: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
C:/Rails/rails/lib/lccs.rb:832: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
C:/Rails/rails/lib/lccs.rb:846: syntax error, unexpected keyword_when, expecting keyword_end
             when 'result' :
                 ^
C:/Rails/rails/lib/lccs.rb:846: syntax error, unexpected ':', expecting keyword_end
C:/Rails/rails/lib/lccs.rb:868: syntax error, unexpected keyword_end, expecting $end

RAILS_ROOT: C:/Rails/rails

Application Trace | Framework Trace | Full Trace
:29:in `require'
:29:in `require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `block in require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
C:/Rails/rails/lib/lccs_helper.rb:1:in `'
C:/Rails/rails/app/controllers/rooms_controller.rb:1:in `'
This error occurred while loading the following files:
   lccs_helper
   lccs

Request

Parameters:

None

Show session dump

Response

Headers:

{"Cache-Control"=>"no-cache",
"Content-Type"=>""}

Thanks

Avatar

Employee

The syntax of case statements in ruby 1.9 has changed (when xxx: is now invalid and should be changed to when xxx then).

You can see it here http://slideshow.rubyforge.org/ruby19.html#16 and here http://blog.elctech.com/2009/04/15/ruby-1-9-compatibility-a-three-step-ladder-to-bliss/

You can try to update the scripts but I have to say those scripts were developed for Ruby 1.8.x and we didn't test compatibility with Ruby 1.9.x so there may be other problems.

I'll add this to my todo list and see if I can have something compatible with both Ruby 1.8 and Ruby 1.8. I really don't want to mantain two versions where the only difference is punctuation

Avatar

Level 2

You are spot on.  It is a compatibility issue.  I'm using ruby 1.9.2p0 and rails 3.  Do you know the exact ruby version (1.8.x) the sample was successfully compiled on?  The scripts use rails 2.3.4 for sure.  I want to quickly setup a virtual machine with everything that worked.  Debugging the scripts will probably take more time.

Thanks

Avatar

Correct answer by
Employee

The compatibilty is between 1.8.x and 1.9.x. The scripts should work well with 1.8.6 or 1.8.7.

The rails app was generated with Rails 2.3.4 but Rails 2.3.5 should work too (if you change the required version in config/environment.rb).

Anyway, I just installed Ruby 1.9.x on my mac and run a quick test. The only error reported where on case/when and in one call to the REXML API.

I am attaching an updated version here, if you want to give it a quick try (but again, I only run a basic test that calls all the APIs with basic parameters).