title: How to implement security Authorization using scala and play?
body: <p>I am using scala and play framework. I want to use play security Authorization in my app.</p>
  
  <p>Previously I implemented it in project using java and play like following : </p>
  
  <pre><code>public class Secured extends Security.Authenticator {
      private static String EMAIL = "Email";
    private static String U_COOKIE = "ucookie";
      public String getUsername(Context ctx) {
          String decodedText = null;
          String CHARSET = "ISO-8859-1";
          Cookies cookies = play.mvc.Controller.request().cookies();
          try {
              Cookie emailCookie = cookies.get(EMAIL);
        Cookie uCookie = cookies.get(U_COOKIE);
        if (uCookie !=null &amp;&amp; uCookie.value() != null) {
      String userId = uCookie.value();
        }
              if (emailCookie != null &amp;&amp; emailCookie.value() != null) {
                  String email = emailCookie.value();
                  try {
                      decodedText = new String(Base64.decodeBase64(email.getBytes(CHARSET)));
                  } catch (UnsupportedEncodingException e) {
                      e.printStackTrace();
                  }
              }
          } catch (Exception e) {
              Logger.error(e.getMessage());
          }
          return decodedText;
      }
  
      public Result onUnauthorized(Context ctx) {
          String done = play.mvc.Controller.request().path();
          return redirect(routes.RegController.signIn(done));
      }
  }
  </code></pre>
  
  <p>and I used above Authorization in all of my method using </p>
  
  <pre><code>@Security.Authenticated(Secured.class)
  </code></pre>
  
  <p>Before any of my methods throughout my application.</p>
  
  <p>When I call any method @before that method gives call to secured class and authenticate user.</p>
  
  <p>Now I want to implement same thing using scala. Following are my questions....</p>
  
  <p>1) Is it possible to use @ to inherit and call methods of secured class??</p>
  
  <p>2) What is the right method to call play's security authentication??</p>
  
  <p>P.S. I want to use cookies for implementation of security Authentication/Authorization.</p>
  
  <p>Any help or workaround will be great favor..</p>