Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. <dependency>
  2. <groupId>org.keycloak</groupId>
  3. <artifactId>keycloak-spring-boot-starter</artifactId>
  4. </dependency>
  5. <dependency>
  6. <groupId>org.keycloak</groupId>
  7. <artifactId>keycloak-spring-security-adapter</artifactId>
  8. </dependency>
  9. <dependency>
  10. <groupId>org.keycloak</groupId>
  11. <artifactId>keycloak-tomcat8-adapter</artifactId>
  12. </dependency>
  13.  
  14. keycloak.enabled=true
  15. keycloak.realm=test
  16. keycloak.auth-server-url=http://localhost:8080/auth
  17. keycloak.ssl-required=external
  18. keycloak.resource=rest
  19. keycloak.bearer-only=true
  20. keycloak.credentials.secret=<secret>
  21. keycloak.principal-attribute=preferred_username
  22. keycloak.security-constraints[0].authRoles[0]=application
  23. keycloak.security-constraints[0].securityCollections[0].name=spring secured api
  24. keycloak.security-constraints[0].securityCollections[0].patterns[0]=/api/**
  25.  
  26. management.security.enabled=false
  27.  
  28. POST /auth/realms/test/protocol/openid-connect/token HTTP/1.1
  29. Host: localhost:8080
  30. Cache-Control: no-cache
  31. Postman-Token: <postman token>
  32. Content-Type: application/x-www-form-urlencoded
  33.  
  34. grant_type=password&client_id=postman&username=root&password=12345678
  35.  
  36. GET /api/product HTTP/1.1
  37. Host: localhost:18888
  38. Authorization: Bearer <keycloak token from the request above>
  39. Cache-Control: no-cache
  40. Postman-Token: <postman token>
  41.  
  42. {
  43. "timestamp": <timestamp>,
  44. "status": 401,
  45. "error": "Unauthorized",
  46. "message": "Full authentication is required to access this resource",
  47. "path": "/api/product"
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement