Re: [cas-user] CAS WAR Overlay - REST APIs added in custom java class not detecting

2020-06-30 Thread Nishant Singh
Hi Ray,

Thanks a lot for your reply. Your response worked for me. I looked into the 
architecture of CAS Support Rest module and understood that you have to 
register your new controller in CasRestConfiguration.java as a bean and 
injecting all the dependencies required by the controller class.

Now i am able to add my own classes in the CAS Overlay Project by 
configuring them and also customize  the existing classes of CAS too.


Nishant Singh

On Friday, 19 June 2020 21:51:39 UTC+5:30, rbon wrote:
>
> Nishant,
>
> You will also have to add, to cas overlay, the configuration to let it 
> know how to handle your endpoint.
> Look in to how cas does its REST login, 
> https://apereo.github.io/cas/development/protocol/REST-Protocol.html. 
> This will require digging in to the cas source, 
> https://github.com/apereo/cas.
>
> Ray
>
> On Fri, 2020-06-19 at 04:52 -0700, Nishant Singh wrote:
>
> Notice: This message was sent from outside the University of Victoria 
> email system. Please be cautious with links and sensitive information. 
>
> I am working on customising *CAR WAR Overlay with version 6.1.x* and add 
> some new functionalities in the form of REST APIs. Now CAS says that in 
> order to add a custom java class we need to do the following: 
>
> *"In order to include custom Java source, it should be included under a 
> src/main/java directory in the overlay project source tree."*
>
> *So i included my java class which is a REST Controller at this location: 
> src/main/java/com/example/rest/RestController.class*
>
> *However, when I run my overlay project in intellij using the command 
> ./gradlew run and try the APIs in Postman then i get 404. Am i missing 
> something here?*
>
> *I want to do the customisation in overlay so i dont face problem whenever 
> i upgrade cas version. **This is the link where CAS explains about the 
> ability to customise is below:*
>
> https://apereo.github.io/cas/development/installation/WAR-Overlay-Installation.html#custom-and-third-party-source
>
> -- 
>
> Ray Bon
> Programmer Analyst
> Development Services, University Systems
> 2507218831 | CLE 019 | rb...@uvic.ca 
>
> I respectfully acknowledge that my place of work is located within the 
> ancestral, traditional and unceded territory of the Songhees, Esquimalt and 
> WSÁNEĆ Nations.
>

-- 
- 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/5658eb19-b00c-4db6-829e-dfe687bbfd33o%40apereo.org.


[cas-user] CAS WAR Overlay - REST APIs added in custom java class not detecting

2020-06-19 Thread Nishant Singh
I am working on customising *CAR WAR Overlay with version 6.1.x* and add 
some new functionalities in the form of REST APIs. Now CAS says that in 
order to add a custom java class we need to do the following:

*"In order to include custom Java source, it should be included under a 
src/main/java directory in the overlay project source tree."*

*So i included my java class which is a REST Controller at this location: 
src/main/java/com/example/rest/RestController.class*

*However, when I run my overlay project in intellij using the command 
./gradlew run and try the APIs in Postman then i get 404. Am i missing 
something here?*

*I want to do the customisation in overlay so i dont face problem whenever 
i upgrade cas version. **This is the link where CAS explains about the 
ability to customise is below:*
https://apereo.github.io/cas/development/installation/WAR-Overlay-Installation.html#custom-and-third-party-source

-- 
- 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/819c31e7-96a3-45b2-823c-4bacbd5da504o%40apereo.org.


[cas-user] Generic OAuth2.0 client redirects to login page instead of service URL specified

2019-08-13 Thread Nishant Singh
Hello,

My CAS application (5.3) does not redirect the user to the provided service 
URL after logging into Instagram using Generic OAuth2.0. Instead the user 
lands on the login page which says Log In Successful and the following 
message:

*You, {user}, have successfully logged into the Central Authentication 
Service. However, you are seeing this page because CAS does not know about 
your target destination and how to get you there. Examine the 
authentication request again and make sure a target service/application 
that is authorized and registered with CAS is specified.*

The user should actually be taken to the service url along with the Service 
Ticket ST parameter. But that is not happening. However, the remaining 
pac4j inbuilt clients like Facebook, Google, LinkedIn etc are working 
properly. This only happens when I am use the OAuth2.0 client for Instagram 
and manually defind the properties in cas.properties page.

*The following is my configuration:*

cas.authn.pac4j.oauth2[0].id={client_id}
cas.authn.pac4j.oauth2[0].secret={client_secret}
cas.authn.pac4j.oauth2[0].authUrl=https://api.instagram.com/oauth/authorize
cas.authn.pac4j.oauth2[0].tokenUrl=https://
api.instagram.com/oauth/access_token
cas.authn.pac4j.oauth2[0].clientName=instagram


cas.authn.pac4j.oauth2[0].profileUrl=https://
api.instagram.com/v1/users/self/
cas.authn.pac4j.oauth2[0].profilePath=data
cas.authn.pac4j.oauth2[0].profileVerb=GET
cas.authn.pac4j.oauth2[0].autoRedirect=true
cas.authn.pac4j.oauth2[0].principalAttributeId=username
cas.authn.pac4j.oauth2[0].profileAttrs.id=id
cas.authn.pac4j.oauth2[0].profileAttrs.fullName=full_name
cas.authn.pac4j.oauth2[0].profileAttrs.pictureUrl=profile_picture

*Service file JSON:*

{
  "@class" : "org.jasig.cas.services.RegexRegisteredService",
  "serviceId" : "^https://.*.{domain}.com.*;,
  "name" : "eyerne",
  "id" : 10002,
  "description" : "This service definition authorizes the eyerne URL.",
  "accessStrategy" : {
"@class" : 
"org.jasig.cas.services.DefaultRegisteredServiceAccessStrategy",
"enabled" : true,
"ssoEnabled" : true
  },
  "bypassApprovalPrompt":true,
  "proxyPolicy" : {
"@class" : 
"org.apereo.cas.services.RegexMatchingRegisteredServiceProxyPolicy",
"pattern" : "^https?://.*"
  },
  "supportedGrantTypes": [ "java.util.HashSet", [ "authorization_code", 
"client_credential"] ],
  "supportedResponseTypes": [ "java.util.HashSet", [ "code", "token" ] ],
  "attributeReleasePolicy" : {
"@class" : "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
  }
}


One thing which i am suspecting is that when i took at the Network monitor 
in Google Chrome I find the following:

1. Before logging in, the last URL from Instagram is as below:

https://www.instagram.com/oauth/authorize?client_name=instagram={service_url}_type=code_id={client_id}_uri=https%3A%2F%2Fwww.cas.{domain}.com%3A8443%2Fcas%2Flogin%3Fclient_name={state}
 

 

2. After then the login page is loaded as follows:

https://www.cas.eyerne.com:8443/cas/login?code={code}={state}

If you carefully look at the Authorization URL in point 1 above, the 
redirect_uri contains the param client_name as blank or empty. I guess due 
to this the login page that loads next does not have to client_name added 
to its URL.

I am not sure this is the root cause, but can anyone help me figure out how 
to redirect the user to the servie URL and not the login page.

-- 
- 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/cf1b1a4a-2c3b-497d-8108-5400ed8f4489%40apereo.org.


[cas-user] Generic OAuth20 Client not redirecting user to server URL after logging-in using delegated authentication with pac4j

2019-08-13 Thread Nishant Singh
Hello,

My CAS application (5.3) does not redirect the user to the provided service 
URL after logging into Instagram using Generic OAuth2.0. Instead the user 
lands on the login page which says Log In Successful and the following 
message:

*You, {user}, have successfully logged into the Central Authentication 
Service. However, you are seeing this page because CAS does not know about 
your target destination and how to get you there. Examine the 
authentication request again and make sure a target service/application 
that is authorized and registered with CAS is specified.*

The user should actually be taken to the service url along with the Service 
Ticket ST parameter. But that is not happening. However, the remaining 
pac4j inbuilt clients like Facebook, Google, LinkedIn etc are working 
properly. This only happens when I am use the OAuth2.0 client for Instagram 
and manually defind the properties in cas.properties page.

*The following is my configuration:*

cas.authn.pac4j.oauth2[0].id={client_id}
cas.authn.pac4j.oauth2[0].secret={client_secret}
cas.authn.pac4j.oauth2[0].authUrl=https://api.instagram.com/oauth/authorize
cas.authn.pac4j.oauth2[0].tokenUrl=https:
//api.instagram.com/oauth/access_token
cas.authn.pac4j.oauth2[0].clientName=instagram


cas.authn.pac4j.oauth2[0].profileUrl=https:
//api.instagram.com/v1/users/self/
cas.authn.pac4j.oauth2[0].profilePath=data
cas.authn.pac4j.oauth2[0].profileVerb=GET
cas.authn.pac4j.oauth2[0].autoRedirect=true
cas.authn.pac4j.oauth2[0].principalAttributeId=username
cas.authn.pac4j.oauth2[0].profileAttrs.id=id
cas.authn.pac4j.oauth2[0].profileAttrs.fullName=full_name
cas.authn.pac4j.oauth2[0].profileAttrs.pictureUrl=profile_picture


One thing which i am suspecting is that when i took at the Network monitor 
in Google Chrome I find the following:

1. Before logging in, the last URL from Instagram is as below:

https://www.instagram.com/oauth/authorize?client_name=inx={service_url}_type=code_id={client_id}_uri=https%3A%2F%2Fwww.cas.{domain}.com%3A8443%2Fcas%2Flogin%3Fclient_name={state}
 

2. After then the login page is loaded as follows:

https://www.cas.eyerne.com:8443/cas/login?code={code}={state}

If you carefully look at the Authorization URL in point 1 above, the 
redirect_uri contains the param client_name as blank or empty. I guess due 
to this the login page that loads next does not have to client_name added 
to its URL.

I am not sure this is the root cause, but can anyone help me figure out how 
to redirect the user to the servie URL and not the login page.

-- 
- 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/3e7432a2-c835-48b4-9f60-02818e4c1617%40apereo.org.