asp.net identity - UserCookieAuthentication in Mono 3.4.1 -
when ever add line below startup class exception below. self hosted exe running mono (ubuntu). works fine in windows. i've narrowed down usecookieauthentication call. can instantiate options without issue. idea going on here? have aspnet identity working , ef6/mysql.
app.usecookieauthentication(new cookieauthenticationoptions());
unhandled exception: system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.typeloadexception: not load type 'microsoft.owin.security.dataprotection.dpapidataprotector' assembly 'microsoft.owin.security, version=2.1.0.0, culture=neutral, publickeytoken=31bf3856ad364e35'. @ microsoft.owin.security.dataprotection.appbuilderextensions.createdataprotector (owin.iappbuilder,string[]) <0x00052> @ microsoft.owin.security.cookies.cookieauthenticationmiddleware..ctor (microsoft.owin.owinmiddleware,owin.iappbuilder,microsoft.owin.security.cookies.cookieauthenticationoptions) <0x00223> @ (wrapper dynamic-method) object.lambda_method (system.runtime.compilerservices.closure,microsoft.owin.owinmiddleware,owin.iappbuilder,microsoft.owin.security.cookies.cookieauthenticationoptions) <0x00048> @ (wrapper managed-to-native) system.reflection.monomethod.internalinvoke (system.reflection.monomethod,object,object[],system.exception&) <0x00067> @ system.reflection.monomethod.invoke (object,system.reflection.bindingflags,system.reflection.binder,object[],system.globalization.cultureinfo) <0x000d7>
--- end of inner exception stack trace --- @ system.reflection.monomethod.invoke (system.object obj, bindingflags invokeattr, system.reflection.binder binder, system.object[] parameters, system.globalization.cultureinfo culture) [0x00000] in :0 @ system.reflection.methodbase.invoke (system.object obj, system.object[] parameters) [0x00000] in :0 @ system.delegate.dynamicinvokeimpl (system.object[] args) [0x00000] in :0 @ system.multicastdelegate.dynamicinvokeimpl (system.object[] args) [0x00000] in :0 @ system.delegate.dynamicinvoke (system.object[] args) [0x00000] in :0 @ microsoft.owin.builder.appbuilder.buildinternal (system.type signature) [0x00000] in :0 @ microsoft.owin.builder.appbuilder.build (system.type returntype) [0x00000] in :0 @ microsoft.owin.hosting.serverfactory.serverfactoryadapter.create (iappbuilder builder) [0x00000] in :0 @ microsoft.owin.hosting.engine.hostingengine.startserver (microsoft.owin.hosting.engine.startcontext context) [0x00000] in :0 @ microsoft.owin.hosting.engine.hostingengine.start (microsoft.owin.hosting.engine.startcontext context) [0x00000] in :0 @ microsoft.owin.hosting.starter.directhostingstarter.start (microsoft.owin.hosting.startoptions options) [0x00000] in :0 @ microsoft.owin.hosting.starter.hostingstarter.start (microsoft.owin.hosting.startoptions options) [0x00000] in :0 @ microsoft.owin.hosting.webapp.startimplementation (iserviceprovider services, microsoft.owin.hosting.startoptions options) [0x00000] in :0 @ microsoft.owin.hosting.webapp.start (microsoft.owin.hosting.startoptions options) [0x00000] in :0 @ microsoft.owin.hosting.webapp.start[startup] (microsoft.owin.hosting.startoptions options) [0x00000] in :0 @ microsoft.owin.hosting.webapp.start[startup] (system.string url) [0x00000] in :0 @ helloworldnancy.program.main (system.string[] args) [0x00000] in :0 [error] fatal unhandled exception: system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.typeloadexception: not load type 'microsoft.owin.security.dataprotection.dpapidataprotector' assembly 'microsoft.owin.security, version=2.1.0.0, culture=neutral, publickeytoken=31bf3856ad364e35'. @ microsoft.owin.security.dataprotection.appbuilderextensions.createdataprotector (owin.iappbuilder,string[]) <0x00052> @ microsoft.owin.security.cookies.cookieauthenticationmiddleware..ctor (microsoft.owin.owinmiddleware,owin.iappbuilder,microsoft.owin.security.cookies.cookieauthenticationoptions) <0x00223> @ (wrapper dynamic-method) object.lambda_method (system.runtime.compilerservices.closure,microsoft.owin.owinmiddleware,owin.iappbuilder,microsoft.owin.security.cookies.cookieauthenticationoptions) <0x00048> @ (wrapper managed-to-native) system.reflection.monomethod.internalinvoke (system.reflection.monomethod,object,object[],system.exception&) <0x00067> @ system.reflection.monomethod.invoke (object,system.reflection.bindingflags,system.reflection.binder,object[],system.globalization.cultureinfo) <0x000d7>
--- end of inner exception stack trace --- @ system.reflection.monomethod.invoke (system.object obj, bindingflags invokeattr, system.reflection.binder binder, system.object[] parameters, system.globalization.cultureinfo culture) [0x00000] in :0 @ system.reflection.methodbase.invoke (system.object obj, system.object[] parameters) [0x00000] in :0 @ system.delegate.dynamicinvokeimpl (system.object[] args) [0x00000] in :0 @ system.multicastdelegate.dynamicinvokeimpl (system.object[] args) [0x00000] in :0 @ system.delegate.dynamicinvoke (system.object[] args) [0x00000] in :0 @ microsoft.owin.builder.appbuilder.buildinternal (system.type signature) [0x00000] in :0 @ microsoft.owin.builder.appbuilder.build (system.type returntype) [0x00000] in :0 @ microsoft.owin.hosting.serverfactory.serverfactoryadapter.create (iappbuilder builder) [0x00000] in :0 @ microsoft.owin.hosting.engine.hostingengine.startserver (microsoft.owin.hosting.engine.startcontext context) [0x00000] in :0 @ microsoft.owin.hosting.engine.hostingengine.start (microsoft.owin.hosting.engine.startcontext context) [0x00000] in :0 @ microsoft.owin.hosting.starter.directhostingstarter.start (microsoft.owin.hosting.startoptions options) [0x00000] in :0 @ microsoft.owin.hosting.starter.hostingstarter.start (microsoft.owin.hosting.startoptions options) [0x00000] in :0 @ microsoft.owin.hosting.webapp.startimplementation (iserviceprovider services, microsoft.owin.hosting.startoptions options) [0x00000] in :0 @ microsoft.owin.hosting.webapp.start (microsoft.owin.hosting.startoptions options) [0x00000] in :0 @ microsoft.owin.hosting.webapp.start[startup] (microsoft.owin.hosting.startoptions options) [0x00000] in :0 @ microsoft.owin.hosting.webapp.start[startup] (system.string url) [0x00000] in :0 @ helloworldnancy.program.main (system.string[] args) [0x00000] in :0
okay happening because owin uses dpapidataprotector default , dpapi windows api (data protection api) , not work in mono. luckily can override default in cookie options. below example aesdataprotectorprovider custom idataprotector found here: using oauth tickets across several services?
app.usecookieauthentication(new cookieauthenticationoptions { ticketdataformat = new securedataformat<authenticationticket>(dataserializers.ticket, new aesdataprotectorprovider("testing"), textencodings.base64) });
with code project starts in mono again.
update:
you can have custom idataprotectionprovider , have of owin use this:
app.setdataprotectionprovider(new customidataprotectionprovider());
Comments
Post a Comment