Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Do not merge: First approach/draft on idrop-web login simplification #32

Open
wants to merge 1 commit into
base: idrop3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions idrop-web3/grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ grails.project.dependency.resolution = {
compile ':scaffolding:2.1.0'
compile ':cache:1.1.3'
compile ':asset-pipeline:1.8.3'

// avoid caching of GSP pages in dev environment
runtime ':cache-headers:1.1.7'

// plugins needed at runtime but not for compilation
//runtime ':hibernate4:4.3.5.2' // or ':hibernate:3.6.10.14'
Expand Down
2 changes: 2 additions & 0 deletions idrop-web3/grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ grails.exceptionresolver.params.exclude = ['password']

// configure auto-caching of queries by default (if false you can cache individual queries with 'cache: true')
grails.hibernate.cache.queries = false
// allow for non-caching of GSP pages while in dev environment: http://stackoverflow.com/questions/13198456/is-there-a-way-to-disable-gsp-caching-for-non-dev-environment
grails.gsp.enable.reload=true

environments {
development {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,31 @@ class LoginController extends RestfulController {

log.info("no validation errors, authenticate")

// In order to simplify the login process, just try all auth methods
// and find the first one that succeeds



def authScheme = AuthScheme.findTypeByString(command.authType)

// Hiding the auth scheme and default port in the login view
if (authScheme == null) {
trySchemes = AuthScheme.authSchemeList()

// XXX: resumable exceptions in Groovy?
for (scheme in trySchemes) {
try {
IRODSAccount irodsAccount = IRODSAccount.instance(command.host, command.port ? command.port: 1247, command.userName, command.password, "", command.zone, "", authScheme)

log.info("using authScheme:${authScheme}")
AuthResponse authResponse = authenticationService.authenticate(irodsAccount)

} catch (e) {
log.info("Failed to authenticate with auth scheme ${scheme}")
}
}
}

log.info("using authScheme:${authScheme}")

IRODSAccount irodsAccount = IRODSAccount.instance(command.host, command.port, command.userName, command.password, "", command.zone, "",authScheme) //FIXME: handle def resc

AuthResponse authResponse = authenticationService.authenticate(irodsAccount)

log.info("auth successful, saving response in session and returning")
session.authenticationSession = authResponse
Expand Down Expand Up @@ -101,6 +119,7 @@ class LoginCommand {
userName(blank: false)
password(blank: false)
defaultStorageResource(nullable:true)
port(nullable:true)
authType(blank: false)
}
}
Expand Down
14 changes: 12 additions & 2 deletions idrop-web3/grails-app/views/login/login.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<div id="legend">
<g:message code="text.login" />
</div>

<div class="control-group">
<!-- Host -->
<label class="control-label" for="host"><g:message
Expand All @@ -19,14 +18,20 @@
</div>
</div>


<div class="control-group">

<%-- XXX: Refer to Config.groovy variables from this view?
<g:if test="${true == false}">
<!-- Port -->
<label class="control-label" for="port"><g:message
code="text.port" /></label>
<div class="controls">
<input type="text" id="port" name="port" placeholder="1247"
class="input-xlarge" ng-model="login.port">
</div>
</div>
</g:if>
--%>
</div>

<div class="control-group">
Expand Down Expand Up @@ -59,13 +64,18 @@
</div>
</div>


<div class="control-group">
<%--
<g:if test="${true == false}">
<!-- authmethod-->
<label class="control-label" for="authtype"><g:message
code="text.auth.type" /></label>
<div class="controls">
<g:select name="authMethod" from="${['Standard', 'PAM']}" value="" ng-model="login.authmethod" />
</div>
</g:if>
--%>
</div>

<div class="control-group">
Expand Down