This project has retired. For details please refer to its Attic page.
LoginService xref
View Javadoc

1   package org.apache.archiva.redback.rest.api.services;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.archiva.redback.authorization.RedbackAuthorization;
23  import org.apache.archiva.redback.rest.api.model.LoginRequest;
24  import org.apache.archiva.redback.rest.api.model.User;
25  
26  import javax.ws.rs.GET;
27  import javax.ws.rs.POST;
28  import javax.ws.rs.Path;
29  import javax.ws.rs.Produces;
30  import javax.ws.rs.QueryParam;
31  import javax.ws.rs.core.MediaType;
32  
33  @Path( "/loginService/" )
34  public interface LoginService
35  {
36  
37      @Path( "addAuthenticationKey" )
38      @GET
39      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
40      @RedbackAuthorization( noRestriction = true )
41      String addAuthenticationKey( @QueryParam( "providerKey" ) String providedKey,
42                                   @QueryParam( "principal" ) String principal, @QueryParam( "purpose" ) String purpose,
43                                   @QueryParam( "expirationMinutes" ) int expirationMinutes )
44          throws RedbackServiceException;
45  
46  
47      @Path( "ping" )
48      @GET
49      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
50      @RedbackAuthorization( noRestriction = true )
51      Boolean ping()
52          throws RedbackServiceException;
53  
54  
55      @Path( "pingWithAutz" )
56      @GET
57      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
58      @RedbackAuthorization( noRestriction = false, noPermission = true )
59      Boolean pingWithAutz()
60          throws RedbackServiceException;
61  
62      /**
63       * check username/password and create a http session.
64       * So no more need of reuse username/password for all ajaxRequest
65       */
66      @Path( "logIn" )
67      @POST
68      @RedbackAuthorization( noRestriction = true, noPermission = true )
69      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
70      User logIn( LoginRequest loginRequest )
71          throws RedbackServiceException;
72  
73      /**
74       * simply check if current user has an http session opened with authz passed and return user data
75       * @since 1.4
76       */
77      @Path( "isLogged" )
78      @GET
79      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
80      @RedbackAuthorization( noRestriction = true )
81      User isLogged()
82          throws RedbackServiceException;
83  
84      /**
85       * clear user http session
86       * @since 1.4
87       */
88      @Path( "logout" )
89      @GET
90      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
91      @RedbackAuthorization( noRestriction = true, noPermission = true )
92      Boolean logout()
93          throws RedbackServiceException;
94  }