Skip to content

Commit 324456d

Browse files
aksinha-nerdapplabspraveen-garg
authored andcommitted
Merged in aksinhanerd/auth/api_exception_handling (pull request nerdapplabs#7)
API Exception handling added
2 parents 130d2ad + 0c2fe1b commit 324456d

22 files changed

+1652
-655
lines changed

app/Resources/views/nav_bootstrap.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<span class="icon-bar"></span>
1010
<span class="icon-bar"></span>
1111
</button>
12-
<a class="navbar-brand" href="/">{{ 'project_name'|trans }}</a>
12+
<a class="navbar-brand" href="{{ path('homepage') }}">{{ 'project_name'|trans }}</a>
1313
</div>
1414
<div id="navbar" class="navbar-collapse collapse">
1515
<ul class="nav navbar-nav">

app/Resources/views/nav_materialize.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<nav class="nav-extended">
33
    <div class="nav-wrapper">
44
<div>
5-
<a href="/">{{ 'project_name'|trans }}</a>
5+
<a href="{{ path('homepage') }}">{{ 'project_name'|trans }}</a>
66
</div>
77
<div id="navbar">
88
<ul>
@@ -25,7 +25,7 @@
2525
</li>
2626
{% else %}
2727
<li><a href="{{ path('fos_user_security_login') }}">{{ 'action.sign_in'|trans }}</a></li>
28-
<li><a href="/register">{{ 'action.sign_up'|trans }}</a></li>
28+
<li><a href="{{ path('fos_user_registration_register') }}">{{ 'action.sign_up'|trans }}</a></li>
2929
{% endif %}
3030
{% if is_granted("ROLE_ADMIN") %}
3131
<li>

app/Resources/views/nav_skeleton.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<nav>
33
    <div>
44
<div>
5-
<a href="/">{{ 'project_name'|trans }}</a>
5+
<a href="{{ path('homepage') }}">{{ 'project_name'|trans }}</a>
66
</div>
77
<div id="navbar">
88
<ul>
@@ -25,7 +25,7 @@
2525
</li>
2626
{% else %}
2727
<li><a href="{{ path('fos_user_security_login') }}">{{ 'action.sign_in'|trans }}</a></li>
28-
<li><a href="/register">{{ 'action.sign_up'|trans }}</a></li>
28+
<li><a href="{{ path('fos_user_registration_register') }}">{{ 'action.sign_up'|trans }}</a></li>
2929
{% endif %}
3030
{% if is_granted("ROLE_ADMIN") %}
3131
<li>

app/config/config.yml

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ imports:
22
- { resource: parameters.yml }
33
- { resource: security.yml }
44
- { resource: services.yml }
5+
- { resource: "@ApiBundle/Resources/config/fos_rest_mime_types.php" }
6+
- { resource: "@ApiBundle/Resources/config/services.yml" }
7+
- { resource: "@ApiBundle/Resources/config/config.yml" }
58

69
# Put parameters here that don't need to change on each machine where the app is deployed
710
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
811
parameters:
912
locale: en
10-
# This parameter defines the codes of the locales (languages) enabled in the application
11-
# app_locales: en|fr|de|es|cs|nl|ru|uk|ro|pt_BR|pl|it|ja|id|ca|sl
12-
app_locales: en|fr|hi
1313

1414
framework:
1515
#esi: ~
@@ -33,13 +33,6 @@ framework:
3333
fragments: ~
3434
http_method_override: true
3535

36-
# Assetic Configuration
37-
assetic:
38-
debug: '%kernel.debug%'
39-
use_controller: '%kernel.debug%'
40-
filters:
41-
cssrewrite: ~
42-
4336
# Twig Configuration
4437
twig:
4538
debug: "%kernel.debug%"
@@ -76,42 +69,3 @@ swiftmailer:
7669
username: "%mailer_user%"
7770
password: "%mailer_password%"
7871
spool: { type: memory }
79-
80-
nelmio_api_doc: ~
81-
82-
fos_rest:
83-
disable_csrf_role: ROLE_API
84-
routing_loader:
85-
default_format: json # All responses should be JSON formated
86-
include_format: false # We do not include format in request, so that all responses
87-
# will eventually be JSON formated
88-
89-
fos_user:
90-
db_driver: orm
91-
firewall_name: main # Seems to be used when registering user/reseting password,
92-
# but since there is no "login", as so it seems to be useless in
93-
# our particular context, but still required by "FOSUserBundle"
94-
user_class: ApiBundle\Entity\User
95-
96-
fos_oauth_server:
97-
db_driver: orm
98-
client_class: ApiBundle\Entity\Client
99-
access_token_class: ApiBundle\Entity\AccessToken
100-
refresh_token_class: ApiBundle\Entity\RefreshToken
101-
auth_code_class: ApiBundle\Entity\AuthCode
102-
service:
103-
user_provider: fos_user.user_manager # This property will be used when valid credentials are given to load the user upon access token creation
104-
options:
105-
supported_scopes: USER
106-
monolog:
107-
handlers:
108-
main:
109-
type: fingers_crossed
110-
action_level: debug # will change to error
111-
handler: nested
112-
nested:
113-
type: stream
114-
path: "%kernel.logs_dir%/%kernel.environment%.log"
115-
level: debug
116-
console:
117-
type: console

app/config/routing.yml

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,3 @@
1-
# These first lines load the all routes defined as @Route() annotations in any
2-
# controller defined inside the src/AppBundle/Controller/ directory. Controllers
3-
# are loaded recursively, so you can separate them into subdirectories.
4-
# If you don't like to add annotations in your applications, you can also define
5-
# the routes in YAML, XML or PHP files.
6-
# See http://symfony.com/doc/current/book/routing.html
7-
app:
8-
resource: '@ApiBundle/Controller/'
9-
type: annotation
10-
prefix: /{_locale}
11-
requirements:
12-
_locale: '%app_locales%'
13-
defaults:
14-
_locale: '%locale%'
15-
16-
# These lines define a route using YAML configuration. The controller used by
17-
# the route (FrameworkBundle:Template:template) is a convenient shortcut when
18-
# the template can be rendered without executing any logic in your own controller.
19-
# See http://symfony.com/doc/current/cookbook/templating/render_without_controller.html
20-
homepage:
21-
path: /{_locale}
22-
requirements:
23-
_locale: '%app_locales%'
24-
defaults:
25-
_controller: FrameworkBundle:Template:template
26-
template: base.html.twig
27-
_locale: '%locale%'
28-
29-
fos_user_security:
30-
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
31-
prefix: /{_locale}
32-
33-
fos_user_resetting:
34-
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
35-
prefix: /{_locale}/resetting
36-
37-
fos_user_profile:
38-
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
39-
prefix: /{_locale}/profile
40-
41-
fos_user_register:
42-
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
43-
prefix: /{_locale}/register
44-
45-
fos_user_change_password:
46-
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
47-
prefix: /{_locale}/profile
48-
49-
NelmioApiDocBundle:
50-
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
51-
prefix: /api/doc
52-
53-
fos_oauth_server_token:
54-
resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml"
1+
users_routing:
2+
resource: "@ApiBundle/Resources/config/routing.yml"
3+
defaults: { _format: json }

app/config/security.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ security:
2929
pattern: ^/api/user/access/token
3030
anonymous: true
3131
stateless: true
32-
request_password_email:
33-
pattern: ^/api/user/resetting/request/email
32+
refresh_token:
33+
pattern: ^/api/user/refresh/token
3434
anonymous: true
3535
stateless: true
36-
check_email:
37-
pattern: ^/api/user/resetting/check/email
36+
request_password_email:
37+
pattern: ^/api/user/resetting/request
3838
anonymous: true
3939
stateless: true
4040
register:

0 commit comments

Comments
 (0)