Apereo CAS OAuth2: callbackAuthorize switch Location to HTTP - java

I have setup a CAS server and I have configured a service for my client-application:
{
"#class" : "org.apereo.cas.support.oauth.services.OAuthRegisteredService",
"clientId": "*********",
"clientSecret": "*****************",
"serviceId" : "^(http|https|imaps)://.*coll.mydomain.org.*",
"name" : "Angular OAuth2 App",
"id" : 10000013,
"supportedGrantTypes": [ "java.util.HashSet", [ "implicit", "refresh_token", "client_credentials" ] ],
"supportedResponseTypes": [ "java.util.HashSet", [ "token" ] ],
"bypassApprovalPrompt" : true,
"jsonFormat" : true,
"attributeReleasePolicy" : {
"#class" : "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
},
"logoutUrl" : "https://sso.coll.mydomain.org/cas/logout"
}
After the user has submitted the login form with is (correct) credentials, the OAuth2 flow goes on and produces this http request
GET https://sso.coll.mydomain.org/cas/oauth2.0/callbackAuthorize?client_id=*************&redirect_uri=https://myclientapp.coll.mydomain.org&response_type=token&client_name=CasOAuthClient&ticket=ST-*********************************************
which gets this (wrong) Location Response Header in which the protocol has switched from HTTPS to HTTP:
location: http://sso.coll.mydomain.org/cas/oauth2.0/authorize?response_type=token&client_id=*************&redirect_uri=https%3A%2F%2Fmyclientapp.coll.mydomain.org
This is a problem because (correctly) interrupts the user-webflow on Chrome with this warning:
"The information you are sending aren't protected"
In the cas.properties:
cas.server.name: https://sso.coll.mydomain.org
cas.server.prefix: https://sso.coll.mydomain.org/cas
Can anyone suggest me what configuration does make CAS to change the protocol in the Response Location Header?
Any suggests will be appreciated.
Thanks to all.

Ok guys, a simple CAS restart resolved the issue. But the reason remains a mistery.

Related

Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential(Deploy)

I would like to deploy BitBucket to Google App Engine, I have done the all configuartion using bitbucket-cloud/docs/deploy-to-google-cloud/ this link. I am getting below error, You can see my log as follows on bitbucket deployment :-
apitools.base.py.exceptions.HttpBadRequestError: HttpError accessing <https://appengine.googleapis.com/v1/apps/evadev0010/services/default/versions?alt=json>: response: <{'vary': 'Origin, X-Origin, Referer', 'content-type': 'application/json; charset=UTF-8', 'date': 'Mon, 29 Jun 2020 11:56:01 GMT', 'server': 'ESF', 'cache-control': 'private', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'alt-svc': 'h3-27=":443"; ma=2592000,h3-25=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'transfer-encoding': 'chunked', 'status': '400', 'content-length': '145', '-content-encoding': 'gzip'}>, content <{
"error": {
"code": 400,
"message": "WEB-INF/appengine-web.xml is required for this runtime.",
"status": "INVALID_ARGUMENT"
}
}
>
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: WEB-INF/appengine-web.xml is required for this runtime.
+ status=1
+ set -e
+
Any help to resolve this issue
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
Thank You

How to deploy asynchronously an application using REST in weblogic 12C?

I have been deploying a weblogic application using the REST api with the following snippet
curl --insecure -X POST --user ${userpass} -F\"deployment=#${appFileName}\" -F\"model={name: '${appName}', deploymentOptions: { retireGracefully: 'false', timeout: '0' } , ${appType} ${appPlanVersion} targets: [ ${appTargets} ]}\" ${wlhost}/management/wls/latest/deployments/application "
I have to wait until this curl ends , but sometimes the request times out because of server configuration.
so, I thought it would be better to do this operation asynchronously, I have read in the documentation that I can use header
-X Prefer:respond-async
but is not clear how to use it, I was not able to find an useful example, once I have added the header, the request is going to return a task URL like
BODY:
{
"links": [{
"rel": "job",
"href": "http:\//localhost:7001/management/weblogic/latest/domainRuntime/deploymentManager/deploymentProgressObjects/fairShare"
}],
"operationType": 5,
"state": "STATE_RUNNING",
"applicationName": "fairShare",
"progress": "processing",
"completed": false
}
how do I poll that job URL to know that the application was deployed and is active ?
If you'll execute:
curl --insecure -X GET --user ${userpass} ${wlhost}/management/tenant-monitoring/applications/${appName}
when application ${appName} is not deployed, you should get 404 Not Found.
when it's deployed, you should get a JSON similar to this:
{
"body": {
"item": {
"name": "${appName}",
"type": "ear",
"state": "STATE_ACTIVE",
"health": "HEALTH_WARN",
"targetStates": [
{
"target": "wls",
"state": "STATE_ACTIVE"
}
],
"dataSources": [],
"workManagers": [
{
"pendingRequests": 0,
"completedRequests": 125,
"name": "default",
"server": "wls"
}
],
"minThreadsConstraints": [],
"maxThreadsConstraints": [],
"requestClasses": []
}
},
"messages": []
}
Tested (in Postman) on WebLogic 12.2.1.4
The answer is to use the request parameter _detached= true
in the post URL,
This will start the deployment asynchronously
for an example , refer to this document.
https://docs.oracle.com/middleware/1213/wls/WLRMR/management_wls_version_deployments_application.htm#WLRMR290

in graphite server - actuator/metrics/http.server.requests count not updating

I have a spring boot project up and running. I have also configured dependency for micrometer-registry-graphite in pom file. And I have installed graphite using docker (downloaded latest version - 1.1.6) and it is running in localhost:80
When I hit the below url it properly shows the hit count.
http://localhost:5080/api/v1/actuator/metrics/http.server.requests?tag=uri:/queue/{queueId}&tag=status:200
Below is the response,
{
"name": "http.server.requests",
"description": null,
"baseUnit": "milliseconds",
"measurements": [
{
"statistic": "COUNT",
"value": 29.0
},
{
"statistic": "TOTAL_TIME",
"value": 942.520949
},
{
"statistic": "MAX",
"value": 0.0
}
],
"availableTags": [
{
"tag": "exception",
"values": [
"None"
]
},
{
"tag": "method",
"values": [
"GET"
]
},
{
"tag": "outcome",
"values": [
"SUCCESS"
]
}
]
}
When I navigate to Graphite Browser, I'm not able to get the count value which I got previously using actuator/metrics url. [We can see the service's url queue/queueId is transformed to some hierarchy form].
And I can see different hierarchical structure (attached the image), why it is showing under exception, None and other unrelated hierarchy. Can someone please explain this and I'm in need of solution to get the hit count in graphite server.
Spring boot version: 2.2.4 RELEASE and
micrometer-registry-graphite version: 1.3.2
I have wrongly pointing my graphite server with port-80 in bootstrap.yml. But port-80 listening fo nginx, where it should point to port-2004 which is listening for carbon receiver. After this change in bootstrap.yml I'm able to resolve this issue.

500 Error from Microsoft Graph on create child in approot

Got the following error while trying to create a folder in my app folder:
com.microsoft.graph.http.GraphFatalServiceException: [This is an unexpected error from Graph, please report this at https://github.com/microsoftgraph/msgraph-sdk-android/issues]
POST https://graph.microsoft.com/v1.0/me/drive/special/approot/children
SdkVersion : graph-android-v1.2.0
Authorization : bearer <REDACTED>
{"folder":{},"name":"gg"}
500 : Internal Server Error
Duration : 234.839
Cache-Control : private
X-Android-Sent-Millis : 1489454003081
Content-Type : application/json
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West US","Slice":"SliceA","ScaleUnit":"000","Host":"AGSFE_IN_2","ADSiteName":"WST"}}
request-id : f25e8a83-5b40-493f-811c-7c9731790c9f
Date : Tue, 14 Mar 2017 01:13:37 GMT
Transfer-Encoding : chunked
X-Android-Response-Source : NETWORK 500
client-request-id : f25e8a83-5b40-493f-811c-7c9731790c9f
X-Android-Received-Millis : 1489454003395
{
"error": {
"code": "generalException",
"message": "An unspecified error has occurred.",
"innerError": {
"request-id": "f25e8a83-5b40-493f-811c-7c9731790c9f",
"date": "2017-03-14T01:13:37"
}
}
}
Per the app folder and the create folder documentation, the request should work given I have "Files.ReadWrite.AppFolder" permission scope.
I created the folder manually and tried to access its metadata and it failed similarly:
com.microsoft.graph.http.GraphFatalServiceException: [This is an unexpected error from Graph, please report this at https://github.com/microsoftgraph/msgraph-sdk-android/issues]
GET https://graph.microsoft.com/v1.0/me/drive/special/approot:/gg:
SdkVersion : graph-android-v1.2.0
Authorization : bearer <REDACTED>
500 : Internal Server Error
Duration : 199.4711
Cache-Control : private
X-Android-Sent-Millis : 1489455064558
Content-Type : application/json
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West US","Slice":"SliceA","ScaleUnit":"003","Host":"AGSFE_IN_3","ADSiteName":"WST"}}
request-id : 660fad6b-491a-4876-98c5-9160c9f8715c
Date : Tue, 14 Mar 2017 01:31:19 GMT
Transfer-Encoding : chunked
X-Android-Response-Source : NETWORK 500
client-request-id : 660fad6b-491a-4876-98c5-9160c9f8715c
X-Android-Received-Millis : 1489455064872
{
"error": {
"code": "generalException",
"message": "An unspecified error has occurred.",
"innerError": {
"request-id": "660fad6b-491a-4876-98c5-9160c9f8715c",
"date": "2017-03-14T01:31:20"
}
}
}
There's a file in the app directory that I can access via its item id and get its contents without issues.
Any ideas what might be causing this issue?
The Files.ReadWrite.AppFolder scope is not currently supported, but cannot be removed for a list of reasons which are unfortunate. You will need to use a different scope, such as Files.ReadWrite, to gain access and create this folder.
Note that even after changing permissions requested by your app, you will need to reconsent to the app to get the new permissions. You can force that to happen to adding &prompt=consent to the end of the OAuth2 Authorization URL or you can remove consent to your app first from

tomcat7 monitoring using jmxtrans

I am using jmxtrans for remote monitoring of tomcat jvm, my request json query is as below
{
"servers" : [ {
"alias" : "MY_TOMCAT",
"local" : false,
"host" : "myhost",
"port" : "myport",
"queries" : [ {
"obj" : "Catalina:type=GlobalRequestProcessor,name=\"http-nio-*\"",
"attr" : [ "requestCount", "requestProcessingTime" ],
"resultAlias" : "tomcat.global-request-processor.http-nio",
"outputWriters" : [ {
"#class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
"settings" : {
"debug" : true
}
} ]
} ],
"url" : "service:jmx:rmi:///jndi/rmi://myhost:myport/jmxrmi"
} ]
}
I have successfully configured jmxtrans to monitor ActiveMQ, but for tomcat its not working.
I am using tomcat-7.40 running on jdk7.
Review and let me know, are there any changes required to json request
I got this resolved. There is nothing wrong / missing with request json.
It was a firewall issue, as jmx port was blocked. After fixing firewall issue it started pulling data from the tomcat.

Categories