I also don't know a way to retrive the hostname. However I would like to 
know what is your use case for the hostname

If, for example, you have 3 hosts that need 3 different customized 
authentication

1) https://i-only-use-saml.example.com
2) https://i-only-use-oauth.example.com
3) https://i-only-use-usernamepassword.example.com

Then you can just registered the above three services, and use the 
"requiredHandler" param to redirect the three use case to a specific 
authentication 
handler. 
https://apereo.github.io/cas/development/installation/Service-Management.html 
(if you are planning to use CAS 5.2.0) 

However, if you need to do much more with the hostname, that service 
management cannot help with your use case, then I might not be able to help 
you... Maybe you need to read the source code to see how it can be retrived.

- Andy


On Thursday, 23 November 2017 22:41:23 UTC+8, snaffy wrote:
>
> I would like to know how I can retrieve the encoded address of the service 
> parameter on the authentication step on the CAS serve side.
> More precisely I have created CustomAuthenticationHandler and at this 
> stage, I need to know from what domain the authentication request came 
> from. For example from this address 
> https://localhost:8445/cas/login?service=https%3A%2F%2Flocalhost%3A8445%2Fcasclient%2F
>  
> I need to extract "localhost"
>
>
> public class CustomAuthenticationHandler implements AuthenticationHandler {
>
>     protected PrincipalFactory principalFactory = new 
> DefaultPrincipalFactory();
>
>     @Autowired
>     PropertiesConfiguration propertiesConfiguration;
>     private transient Logger logger = 
> LoggerFactory.getLogger(this.getClass());
>
>    
>     @Override
>     public HandlerResult authenticate(Credential credential) throws 
> GeneralSecurityException, PreventedException {
>
>         UsernamePasswordCredential usernamePasswordCredential = 
> (UsernamePasswordCredential) credential;
>        // Here I would like to have access to the encoded address
>    }
>
> Thanks in advance for help. 
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/f1ae4e4e-76f8-40ac-9ffc-1ff5ceb481a3%40apereo.org.

Reply via email to