providers/*: fix launch_url not working
This commit is contained in:
parent
1eeb64ee39
commit
cba78b4de7
|
@ -160,7 +160,7 @@ class Application(PolicyBindingModel):
|
||||||
if self.meta_launch_url:
|
if self.meta_launch_url:
|
||||||
return self.meta_launch_url
|
return self.meta_launch_url
|
||||||
if self.provider:
|
if self.provider:
|
||||||
return self.provider.launch_url
|
return self.get_provider().launch_url
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_provider(self) -> Optional[Provider]:
|
def get_provider(self) -> Optional[Provider]:
|
||||||
|
|
|
@ -269,12 +269,11 @@ class OAuth2Provider(Provider):
|
||||||
@property
|
@property
|
||||||
def launch_url(self) -> Optional[str]:
|
def launch_url(self) -> Optional[str]:
|
||||||
"""Guess launch_url based on first redirect_uri"""
|
"""Guess launch_url based on first redirect_uri"""
|
||||||
if not self.redirect_uris:
|
if self.redirect_uris == "":
|
||||||
return None
|
return None
|
||||||
main_url = self.redirect_uris[0]
|
main_url = self.redirect_uris.split("\n")[0]
|
||||||
launch_url = urlparse(main_url)
|
launch_url = urlparse(main_url)
|
||||||
launch_url.path = ""
|
return main_url.replace(launch_url.path, "")
|
||||||
return launch_url.geturl()
|
|
||||||
|
|
||||||
def form(self) -> Type[ModelForm]:
|
def form(self) -> Type[ModelForm]:
|
||||||
from passbook.providers.oauth2.forms import OAuth2ProviderForm
|
from passbook.providers.oauth2.forms import OAuth2ProviderForm
|
||||||
|
|
|
@ -107,8 +107,7 @@ class SAMLProvider(Provider):
|
||||||
def launch_url(self) -> Optional[str]:
|
def launch_url(self) -> Optional[str]:
|
||||||
"""Guess launch_url based on acs URL"""
|
"""Guess launch_url based on acs URL"""
|
||||||
launch_url = urlparse(self.acs_url)
|
launch_url = urlparse(self.acs_url)
|
||||||
launch_url.path = ""
|
return self.acs_url.replace(launch_url.path, "")
|
||||||
return launch_url.geturl()
|
|
||||||
|
|
||||||
def form(self) -> Type[ModelForm]:
|
def form(self) -> Type[ModelForm]:
|
||||||
from passbook.providers.saml.forms import SAMLProviderForm
|
from passbook.providers.saml.forms import SAMLProviderForm
|
||||||
|
|
Reference in New Issue