If you can fetch groups as attributes, this should help: 
https://apereo.github.io/cas/5.2.x/installation/Configuring-Service-Access-Strategy.html
 

Otherwise, you should look into authentication policies. 

--Misagh 

> From: "Donghua Liu" <[email protected]>
> To: "CAS Community" <[email protected]>
> Cc: "Misagh Moayyed" <[email protected]>
> Sent: Wednesday, May 2, 2018 5:40:21 PM
> Subject: Re: [cas-user] How to obtain service url in my custom Authentication
> Handlers

> I have a lot of users which organized by some groups, and I want to authorize
> different service to groups.
> For example, group g1 which contains user u1 and u2 , and this group has
> permission to access service s1 and s2 , group g2 which contains user u2 , u3 
> ,
> and this group has permission to access service s3 . Then u1 have access to
> service s1 and s2, u2 have access to service s1, s2 and s3, u3 only have 
> access
> to s3.
> (sorry for my bad English)

> 在 2018年5月2日星期三 UTC+8下午8:05:08,Misagh Moayyed写道:
>> Short answer is, you cannot (in a way that would safe and sensible).

>> What do you mean by " compare the current service url to decide whether
>> authenticate success or failed."?

>> --Misagh

>>> From: "Donghua Liu" < [email protected] >
>>> To: "CAS Community" < [email protected] >
>>> Sent: Wednesday, May 2, 2018 12:14:11 AM
>>> Subject: Re: [cas-user] How to obtain service url in my custom 
>>> Authentication
>>> Handlers

>>> I went through this documentation, but I couldn't find how can I get the
>>> requested service url.

>>> 在 2018年5月2日星期三 UTC+8上午8:51:09,paul li写道:
>>>> hi,
>>>> You just need to follow what's in
>>>> https://apereo.github.io/cas/5.2.x/installation/Configuring-Custom-Authentication.html
>>>> step by step.

>>>> 1. Create a custom authentication handler class
>>>> public class MyAuthenticationHandler extends
>>>> AbstractUsernamePasswordAuthenticationHandler {

>>>> 2. Create a custom PlanConfiguation class that implements
>>>> AuthenicationEventExecutionPlanConfigurer, to register your handler class
>>>> @Configuration ( "MyAuthenticationEventExecutionPlanConfiguration" )
>>>> @EnableConfigurationProperties ( CasConfigurationProperties . class ) 
>>>> public
>>>> class MyAuthenticationEventExecutionPlanConfiguration implements
>>>> AuthenticationEventExecutionPlanConfigurer {

>>>> 3. In src/main/resources/META-INF/spring.factories
>>>> register your custom PlanConfiguation
>>>> org.springframework.boot.autoconfigure.EnableAutoConfiguration =
>>>> com.example.cas.MyAuthenticationEventExecutionPlanConfiguration
>>>> Rebuild and deploy your code, it's best to set your log level to DEBUG to 
>>>> see
>>>> the the debugg messages under org.aperero.cas...

>>>> When CAS first starts, you'll see the custom PlanConfiguration class gets
>>>> initialized, followed by your handler.

>>>> Thanks

>>>> On Tue, May 1, 2018 at 10:39 AM, Donghua Liu < [email protected] > wrote:

>>>>> hi,
>>>>> I want to implement a custome Authentication Handlers which get related
>>>>> permission and compare the current service url to decide whether 
>>>>> authenticate
>>>>> success or failed.
>>>>> After reading Configuring-Custom-Authentication , It seems I need to 
>>>>> extend
>>>>> AbstractUsernamePasswordAuthenticationHandler , but I could not find any 
>>>>> clues
>>>>> on how to get service url.

>>>>> --
>>>>> - 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 [email protected] .
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/a/apereo.org/d/msgid/cas-user/6b4e24ec-c49b-4e26-8b92-7ca9a798306a%40apereo.org
>>>>> .

>>> --
>>> - 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 [email protected] .
>>> To view this discussion on the web visit
>>> https://groups.google.com/a/apereo.org/d/msgid/cas-user/3c832774-7329-43a5-befa-ffe6a9a2cd4c%40apereo.org
>>> .

> --
> - 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 [email protected] .
> To view this discussion on the web visit
> https://groups.google.com/a/apereo.org/d/msgid/cas-user/c05cbce4-79dc-4096-b0f7-c5abe2123840%40apereo.org
> .

-- 
- 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/807528930.21503981.1525338249418.JavaMail.zimbra%40unicon.net.

Reply via email to