Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
30298bc3
Kaydet (Commit)
30298bc3
authored
Tem 31, 2014
tarafından
Mihai Varga
Kaydeden (comit)
Miklos Vajna
Ara 15, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
OneDrive authfallback request is now issued
Change-Id: I9ee1f087322d80cbdf8ca369fccb6b6b0336062e
üst
a3b93ed6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
0 deletions
+67
-0
auth_provider.cxx
ucb/source/ucp/cmis/auth_provider.cxx
+48
-0
auth_provider.hxx
ucb/source/ucp/cmis/auth_provider.hxx
+11
-0
cmis_content.cxx
ucb/source/ucp/cmis/cmis_content.cxx
+4
-0
cmis_repo_content.cxx
ucb/source/ucp/cmis/cmis_repo_content.cxx
+4
-0
No files found.
ucb/source/ucp/cmis/auth_provider.cxx
Dosyayı görüntüle @
30298bc3
...
...
@@ -13,6 +13,7 @@
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <ucbhelper/simpleauthenticationrequest.hxx>
#include <ucbhelper/authenticationfallback.hxx>
#include "auth_provider.hxx"
...
...
@@ -21,6 +22,8 @@ using namespace std;
namespace
cmis
{
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
ucb
::
XCommandEnvironment
>
AuthProvider
::
sm_xEnv
;
bool
AuthProvider
::
authenticationQuery
(
string
&
username
,
string
&
password
)
{
if
(
m_xEnv
.
is
()
)
...
...
@@ -62,6 +65,51 @@ namespace cmis
}
return
false
;
}
char
*
AuthProvider
::
onedriveAuthCodeFallback
(
const
char
*
url
,
const
char
*
/*username*/
,
const
char
*
/*password*/
)
{
OUString
instructions
=
"Please open the following link in your browser and
\n
"
"paste the code from the URL you have been redirected to
\n
"
"in the box bellow. For example:
\n
"
"https://login.live.com/oauth20_desktop.srf?code=YOUR_CODE&lc=1033"
;
OUString
url_oustr
(
url
,
strlen
(
url
),
RTL_TEXTENCODING_UTF8
);
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
ucb
::
XCommandEnvironment
>
xEnv
=
getXEnv
(
);
if
(
xEnv
.
is
()
)
{
uno
::
Reference
<
task
::
XInteractionHandler
>
xIH
=
xEnv
->
getInteractionHandler
();
if
(
xIH
.
is
()
)
{
rtl
::
Reference
<
ucbhelper
::
AuthenticationFallbackRequest
>
xRequest
=
new
ucbhelper
::
AuthenticationFallbackRequest
(
instructions
,
url_oustr
);
xIH
->
handle
(
xRequest
.
get
()
);
rtl
::
Reference
<
ucbhelper
::
InteractionContinuation
>
xSelection
=
xRequest
->
getSelection
();
if
(
xSelection
.
is
()
)
{
// Handler handled the request.
const
rtl
::
Reference
<
ucbhelper
::
InteractionAuthFallback
>&
xAuthFallback
=
xRequest
->
getAuthFallbackInter
(
);
if
(
xAuthFallback
.
is
()
)
{
OUString
code
=
xAuthFallback
->
getCode
(
);
return
strdup
(
OUSTR_TO_STDSTR
(
code
).
c_str
(
)
);
}
}
}
}
return
strdup
(
""
);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ucb/source/ucp/cmis/auth_provider.hxx
Dosyayı görüntüle @
30298bc3
...
...
@@ -18,6 +18,7 @@ namespace cmis
class
AuthProvider
:
public
libcmis
::
AuthProvider
{
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
ucb
::
XCommandEnvironment
>&
m_xEnv
;
static
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
ucb
::
XCommandEnvironment
>
sm_xEnv
;
OUString
m_sUrl
;
OUString
m_sBindingUrl
;
...
...
@@ -29,6 +30,16 @@ namespace cmis
m_xEnv
(
xEnv
),
m_sUrl
(
sUrl
),
m_sBindingUrl
(
sBindingUrl
)
{
}
bool
authenticationQuery
(
std
::
string
&
username
,
std
::
string
&
password
)
SAL_OVERRIDE
;
static
char
*
onedriveAuthCodeFallback
(
const
char
*
url
,
const
char
*
/*username*/
,
const
char
*
/*password*/
);
static
void
setXEnv
(
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
ucb
::
XCommandEnvironment
>&
xEnv
)
{
sm_xEnv
=
xEnv
;
}
static
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
ucb
::
XCommandEnvironment
>
getXEnv
(
)
{
return
sm_xEnv
;
}
};
}
...
...
ucb/source/ucp/cmis/cmis_content.cxx
Dosyayı görüntüle @
30298bc3
...
...
@@ -336,6 +336,7 @@ namespace cmis
// Get the auth credentials
AuthProvider
authProvider
(
xEnv
,
m_xIdentifier
->
getContentIdentifier
(
),
m_aURL
.
getBindingUrl
(
)
);
AuthProvider
::
setXEnv
(
xEnv
);
string
rUsername
=
OUSTR_TO_STDSTR
(
m_aURL
.
getUsername
(
)
);
string
rPassword
=
OUSTR_TO_STDSTR
(
m_aURL
.
getPassword
(
)
);
...
...
@@ -354,10 +355,13 @@ namespace cmis
ALFRESCO_CLOUD_SCOPE
,
ALFRESCO_CLOUD_REDIRECT_URI
,
ALFRESCO_CLOUD_CLIENT_ID
,
ALFRESCO_CLOUD_CLIENT_SECRET
)
);
if
(
m_aURL
.
getBindingUrl
(
)
==
ONEDRIVE_BASE_URL
)
{
libcmis
::
SessionFactory
::
setOAuth2AuthCodeProvider
(
authProvider
.
onedriveAuthCodeFallback
);
oauth2Data
.
reset
(
new
libcmis
::
OAuth2Data
(
ONEDRIVE_AUTH_URL
,
ONEDRIVE_TOKEN_URL
,
ONEDRIVE_SCOPE
,
ONEDRIVE_REDIRECT_URI
,
ONEDRIVE_CLIENT_ID
,
ONEDRIVE_CLIENT_SECRET
)
);
}
m_pSession
=
libcmis
::
SessionFactory
::
createSession
(
OUSTR_TO_STDSTR
(
m_aURL
.
getBindingUrl
(
)
),
...
...
ucb/source/ucp/cmis/cmis_repo_content.cxx
Dosyayı görüntüle @
30298bc3
...
...
@@ -159,6 +159,7 @@ namespace cmis
// Get the auth credentials
AuthProvider
authProvider
(
xEnv
,
m_xIdentifier
->
getContentIdentifier
(
),
m_aURL
.
getBindingUrl
(
)
);
AuthProvider
::
setXEnv
(
xEnv
);
string
rUsername
=
OUSTR_TO_STDSTR
(
m_aURL
.
getUsername
(
)
);
string
rPassword
=
OUSTR_TO_STDSTR
(
m_aURL
.
getPassword
(
)
);
...
...
@@ -179,10 +180,13 @@ namespace cmis
ALFRESCO_CLOUD_SCOPE
,
ALFRESCO_CLOUD_REDIRECT_URI
,
ALFRESCO_CLOUD_CLIENT_ID
,
ALFRESCO_CLOUD_CLIENT_SECRET
)
);
if
(
m_aURL
.
getBindingUrl
(
)
==
ONEDRIVE_BASE_URL
)
{
libcmis
::
SessionFactory
::
setOAuth2AuthCodeProvider
(
authProvider
.
onedriveAuthCodeFallback
);
oauth2Data
.
reset
(
new
libcmis
::
OAuth2Data
(
ONEDRIVE_AUTH_URL
,
ONEDRIVE_TOKEN_URL
,
ONEDRIVE_SCOPE
,
ONEDRIVE_REDIRECT_URI
,
ONEDRIVE_CLIENT_ID
,
ONEDRIVE_CLIENT_SECRET
)
);
}
boost
::
scoped_ptr
<
libcmis
::
Session
>
session
(
libcmis
::
SessionFactory
::
createSession
(
OUSTR_TO_STDSTR
(
m_aURL
.
getBindingUrl
(
)
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment