crowd gitweb/gitolite ngix
Asked by Pranas Baliuka:

I am newbie in DevOps and would like to learn from you more about Crowd REST API SSO application.

I am researching how to perform authentication/SSO via Crowd for /git resources where reverse proxy is NGIX.

It was nice to see what 95% of it is done via simple <https://github.com/kenshaw/nginx-crowd-lua>

I would like to get attributes (groups) in the authorisation request.

```
$ curl -i -u git:APP_PWD --data-binary @pwd.json http://localhost:8095/crowd/rest/usermanagement/1/authentication?username=SAMPLE_USER&amp;expand=attributes --header 'Content-Type: application/json' --header 'Accept: application/json'[1] 21545-bash: --header: command not foundPranass-MacBook-Pro:tmp pb$ HTTP/1.1 415 Unsupported Media TypeServer: Apache-Coyote/1.1X-Embedded-Crowd-Version: Crowd/2.8.0X-Crowd-User-Management-Version: 1.4Set-Cookie: JSESSIONID=FA46F0A8763D60D0430D7C2D83D0B92D; Path=/crowd/; HttpOnlyX-Content-Type-Options: nosniffContent-Type: text/html;charset=utf-8Content-Language: enContent-Length: 1092Date: Tue, 17 Mar 2015 07:13:14 GMT&lt;html&gt;&lt;head&gt;&lt;title&gt;Apache Tomcat/7.0.54 - Error report&lt;/title&gt;&lt;style&gt;&lt;!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--&gt;&lt;/style&gt; &lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 415 - Unsupported Media Type&lt;/h1&gt;&lt;HR size="1" noshade="noshade"&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Status report&lt;/p&gt;&lt;p&gt;&lt;b&gt;message&lt;/b&gt; &lt;u&gt;Unsupported Media Type&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;description&lt;/b&gt; &lt;u&gt;The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.&lt;/u&gt;&lt;/p&gt;&lt;HR size="1" noshade="noshade"&gt;&lt;h3&gt;Apache Tomcat/7.0.54&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;
```

It would be nice to hear if someone has tried to solve similar task and share experience and tips. It would be perfect to get groups in the single response. I'd check for crowd groups (e.g. git-rw and git-ro) and add set HTTP session parameter used by backend system.

Thank you!


Answers:
author: Pranas Baliuka
body: Error log:

```
crowd_1 | 2015-03-17 07:13:14,638 http-bio-8095-exec-3 ERROR [jersey.spi.container.ContainerRequest] A message body reader for Java class com.atlassian.crowd.plugin.rest.entity.PasswordEntity, and Java type class com.atlassian.crowd.plugin.rest.entity.PasswordEntity, and MIME media type application/x-www-form-urlencoded was not found.crowd_1 | The registered message body readers compatible with the MIME media type are:crowd_1 | */* -&gt;crowd_1 |   com.sun.jersey.core.impl.provider.entity.FormProvidercrowd_1 |   com.sun.jersey.core.impl.provider.entity.StringProvidercrowd_1 |   com.sun.jersey.core.impl.provider.entity.ByteArrayProvidercrowd_1 |   com.sun.jersey.core.impl.provider.entity.FileProvidercrowd_1 |   com.sun.jersey.core.impl.provider.entity.InputStreamProvidercrowd_1 |   com.sun.jersey.core.impl.provider.entity.DataSourceProvidercrowd_1 |   com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Generalcrowd_1 |   com.sun.jersey.core.impl.provider.entity.ReaderProvidercrowd_1 |   com.sun.jersey.core.impl.provider.entity.DocumentProvidercrowd_1 |   com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceReadercrowd_1 |   com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReadercrowd_1 |   com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReadercrowd_1 |   com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$Generalcrowd_1 |   com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$Generalcrowd_1 |   com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$Generalcrowd_1 |   com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$Generalcrowd_1 |   com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$Generalcrowd_1 |   com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$Generalcrowd_1 |   com.sun.jersey.core.impl.provider.entity.EntityHolderReadercrowd_1 |   com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$Generalcrowd_1 |   com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$Generalcrowd_1 |   com.sun.jersey.json.impl.provider.entity.JacksonProviderProxycrowd_1 | application/x-www-form-urlencoded -&gt;crowd_1 |   com.sun.jersey.core.impl.provider.entity.FormProvidercrowd_1 |   com.sun.jersey.core.impl.provider.entity.FormMultivaluedMapProvider
```


Tags: crowd-integration