You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by Roman Isitua <ro...@gmail.com> on 2021/09/03 17:02:02 UTC

Spring Boot, BlazeDS and Security

Spring Boot, BlazeDS and Security

I am trying to implement custom authentication using spring blazeds and
spring boot.
I have written a custom authentication provider.

My configuration is as follows


@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter
{

private static final Logger logger =
Logger.getLogger(WebSecurityConfig.class.getName());


   @Autowired
   private CrmDBRealm authProvider;

  // @Autowired
  // private PreAuthenticate preAuthenticate;

   public WebSecurityConfig()
   {

      logger.info(" -- WebSecurityConfig() -- ");

   }


   @Override
   protected void configure(AuthenticationManagerBuilder auth) throws
Exception
   {
      logger.info(" ----- configure auth provider -------");

       auth.authenticationProvider(authProvider);

       logger.info(" crm db realm registered as auth provider ");
   }


   @Override
    protected void configure(HttpSecurity http) throws Exception
     {
         logger.info(" -- configure -- ");

        // spring blazeds specific security configuration here.
       //

    }

}

When I try to access the url

http://localhost:8080/js-debug/index.html

The index.html page opens but I get the following error from royale

 init ServiceDAO ..
Language.as:254  -- ServiceDAO() --
Language.as:254  create remote object ...
Language.as:254  set channel set ..
Language.as:254  set channel websocketAmf
Language.as:254  set url http://localhost:8080/messagebroker/websocket-amf
Language.as:254  credentials username: admin-Test25 password: 123
Language.as:254  invoke log in command . . .
Language.as:254  the token:  mx.rpc.AsyncToken {disposed_: false,
onDisposeCallbacks_: undefined, eventTargetListeners_: g…g.e…s.ListenerMap,
actualEventTarget_: mx.rpc.AsyncToken, parentEventTarget_: null, …}
Language.as:254  after invocation !!
AMFNetConnection.as:336 POST
http://localhost:8080/messagebroker/websocket-amf 403 (Forbidden)
org.apache.royale.net.remoting.amf.AMFNetConnection.org_apache_royale_net_remoting_amf_AMFNetConnection_onReadyStateChange
@ AMFNetConnection.as:336
(anonymous) @ AMFNetConnection.as:152
org.apache.royale.net.remoting.amf.AMFNetConnection.org_apache_royale_net_remoting_amf_AMFNetConnection__processCallItem
@ AMFNetConnection.as:161
org.apache.royale.net.remoting.amf.AMFNetConnection.org_apache_royale_net_remoting_amf_AMFNetConnection__processQueue
@ AMFNetConnection.as:142
Language.as:254 fault result: [RPC Fault faultString=""
faultCode="Client.Error.MessageSend" faultDetail="Channel.Ping.Failed error
undefined url: 'http://localhost:8080/messagebroker/websocket-amf'"]


The royale log in code is a follows

   var channelSet:ChannelSet = new ChannelSet();

                        //   ro.channelSet=channelSet;


                  var channel:String = "websocketAmf";
                  var url:String = "
http://localhost:8080/messagebroker/websocket-amf";

                      trace(" set channel " + channel);

                       trace(" set url " + url);


                       var c:Channel=new AMFChannel(channel, url);

                    channelSet.addChannel(c);

                       var userName:String = "admin-Test25";
                       var password: String = "123";

                       trace(" credentials username: " + userName +
" password: " + password);

                       trace(" invoke log in command . . . ");

                      var asyncToken:AsyncToken
 = channelSet.login(userName, password);


                           var responder:Responder = new Responder
(onResult, onFault);

                          asyncToken.addResponder(responder);

                            trace(" the token: ", asyncToken);

                          trace(" after invocation !! ");


I stumbled upon an example that was based on the spring xml configuration

https://gomtiprabha.wordpress.com/2012/05/10/spring-security-with-blazeds-and-flex-custom-user-details/

I am still trying to figure out how to replicate some of the steps listed
there in spring boot.

Regards,