1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
%typemap(javainterfaces) RobotRaconteur::UserAuthenticator "IUserAuthenticator";
%typemap(javacode) RobotRaconteur::UserAuthenticator
%{
@Override
public AuthenticatedUser authenticateUser(String username, java.util.Map<String,Object> credentials, ServerContext context)
{
MessageElement c =(MessageElement) RobotRaconteurNode.s().<String,Object>packMapType(credentials,String.class, Object.class);
return _AuthenticateUser(username, c, context);
}
%}
%typemap(javacode) RobotRaconteur::ServiceSecurityPolicy
%{
static private class WrappedUserAuthenticatorDirectorNET extends WrappedUserAuthenticatorDirector
{
IUserAuthenticator target;
public WrappedUserAuthenticatorDirectorNET(IUserAuthenticator target)
{
this.target = target;
}
@Override
public AuthenticatedUser authenticateUser(String username, MessageElement credentials, ServerContext context)
{
IUserAuthenticator t = target;
if (t == null) throw new AuthenticationException("Authenticator internal error");
java.util.Map<String, Object> c2 = (java.util.Map<String, Object>)RobotRaconteurNode.s().<String, Object>unpackMapType(credentials);
AuthenticatedUser ret = t.authenticateUser(username, c2, context);
return ret;
}
}
public ServiceSecurityPolicy(IUserAuthenticator authenticator, java.util.Map<String,String> Policies) {
map_strstr Policies2=new map_strstr();
for (java.util.Map.Entry<String,String> m : Policies.entrySet())
{
Policies2.put(m.getKey(), m.getValue());
}
NativeUserAuthenticator a2;
if (authenticator instanceof NativeUserAuthenticator)
{
a2= (NativeUserAuthenticator)authenticator;
}
else
{
WrappedUserAuthenticatorDirectorNET n = new WrappedUserAuthenticatorDirectorNET(authenticator);
int id = RRObjectHeap.addObject(n);
WrappedUserAuthenticator a3 = new WrappedUserAuthenticator();
a3.setRRDirector(n, id);
a2=a3;
}
swigCPtr=RobotRaconteurJavaJNI.new_ServiceSecurityPolicy(NativeUserAuthenticator.getCPtr(a2), a2, map_strstr.getCPtr(Policies2), Policies2);
}
%}
%include "ServiceSecurity.i"
|